@xh/hoist 89.0.1 → 89.2.0

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/build/types/cmp/grid/GridModel.d.ts +6 -0
  3. package/build/types/cmp/input/impl/LiveCommas.d.ts +21 -0
  4. package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +4 -2
  5. package/build/types/core/XH.d.ts +2 -1
  6. package/build/types/core/model/HoistModel.d.ts +1 -0
  7. package/build/types/core/model/ManagedRefreshContextModel.d.ts +1 -0
  8. package/build/types/core/persist/PersistenceProvider.d.ts +3 -0
  9. package/build/types/data/cube/View.d.ts +0 -2
  10. package/build/types/data/cube/impl/RowCache.d.ts +1 -1
  11. package/build/types/data/cube/row/BaseRow.d.ts +5 -0
  12. package/build/types/desktop/cmp/dash/DashViewSpec.d.ts +2 -1
  13. package/build/types/desktop/cmp/dash/canvas/impl/DashCanvasContextMenu.d.ts +1 -1
  14. package/build/types/desktop/cmp/dash/canvas/widgetchooser/DashCanvasWidgetChooser.d.ts +3 -2
  15. package/build/types/desktop/cmp/dash/container/impl/DashContainerContextMenu.d.ts +1 -1
  16. package/build/types/desktop/cmp/dash/impl/DashUtils.d.ts +35 -0
  17. package/build/types/desktop/cmp/grid/editors/impl/InlineEditorModel.d.ts +6 -1
  18. package/build/types/desktop/cmp/input/NumberInput.d.ts +5 -2
  19. package/build/types/desktop/cmp/tab/dynamic/DynamicTabSwitcherModel.d.ts +1 -2
  20. package/build/types/mobile/cmp/input/NumberInput.d.ts +5 -2
  21. package/build/types/svc/FetchService.d.ts +19 -0
  22. package/build/types/test-support/agGrid.d.ts +2 -0
  23. package/build/types/test-support/hoistCore.d.ts +7 -1
  24. package/build/types/test-support/index.d.ts +1 -0
  25. package/build/types/test-support/jsonBlobs.d.ts +130 -0
  26. package/build/types/test-support/testApp.d.ts +5 -2
  27. package/cmp/grid/Grid.ts +2 -2
  28. package/cmp/grid/GridModel.ts +14 -1
  29. package/cmp/grid/columns/Column.ts +3 -2
  30. package/cmp/input/impl/LiveCommas.ts +59 -0
  31. package/cmp/viewmanager/ViewManagerModel.ts +25 -7
  32. package/core/XH.ts +8 -3
  33. package/core/model/HoistModel.ts +4 -2
  34. package/core/model/Hooks.ts +1 -0
  35. package/core/model/ManagedRefreshContextModel.ts +5 -1
  36. package/core/persist/PersistenceProvider.ts +15 -1
  37. package/data/cube/View.ts +3 -9
  38. package/data/cube/impl/RowCache.ts +2 -2
  39. package/data/cube/row/BaseRow.ts +14 -1
  40. package/data/cube/row/ParentRow.ts +1 -1
  41. package/desktop/cmp/dash/DashViewSpec.ts +2 -1
  42. package/desktop/cmp/dash/README.md +6 -5
  43. package/desktop/cmp/dash/canvas/impl/DashCanvasContextMenu.ts +1 -1
  44. package/desktop/cmp/dash/canvas/impl/utils.ts +16 -51
  45. package/desktop/cmp/dash/canvas/widgetchooser/DashCanvasWidgetChooser.ts +37 -54
  46. package/desktop/cmp/dash/container/impl/DashContainerContextMenu.ts +8 -39
  47. package/desktop/cmp/dash/impl/DashUtils.ts +90 -0
  48. package/desktop/cmp/grid/editors/BooleanEditor.ts +2 -1
  49. package/desktop/cmp/grid/editors/DateEditor.ts +4 -1
  50. package/desktop/cmp/grid/editors/SelectEditor.ts +4 -1
  51. package/desktop/cmp/grid/editors/impl/InlineEditorModel.ts +17 -5
  52. package/desktop/cmp/input/NumberInput.ts +51 -12
  53. package/desktop/cmp/input/Select.ts +25 -7
  54. package/desktop/cmp/tab/TabSwitcher.ts +4 -6
  55. package/desktop/cmp/tab/dynamic/DynamicTabSwitcher.ts +4 -5
  56. package/desktop/cmp/tab/dynamic/DynamicTabSwitcherModel.ts +2 -7
  57. package/docs/README.md +2 -0
  58. package/docs/build-and-publish.md +21 -11
  59. package/docs/companion-library-docs.md +205 -0
  60. package/docs/doc-registry.json +9 -1
  61. package/docs/lifecycle-app.md +17 -0
  62. package/docs/lifecycle-models-and-services.md +2 -1
  63. package/docs/persistence.md +2 -0
  64. package/docs/telemetry.md +29 -0
  65. package/docs/unit-testing.md +54 -3
  66. package/docs/upgrade-notes/v89-upgrade-notes.md +7 -1
  67. package/docs/version-compatibility.md +2 -1
  68. package/icon/README.md +4 -1
  69. package/mcp/README.md +79 -4
  70. package/mcp/cli/docs.ts +75 -30
  71. package/mcp/data/doc-id-resolver.ts +50 -9
  72. package/mcp/data/doc-registry.ts +462 -44
  73. package/mcp/data/doc-search.ts +25 -6
  74. package/mcp/formatters/docs.ts +136 -36
  75. package/mcp/instructions.ts +69 -0
  76. package/mcp/resources/docs.ts +10 -8
  77. package/mcp/server.ts +7 -13
  78. package/mcp/tools/docs.ts +64 -18
  79. package/mcp/util/paths.ts +85 -2
  80. package/mobile/cmp/input/NumberInput.ts +42 -4
  81. package/package.json +19 -19
  82. package/public/msal-redirect-bridge.min.js +1 -1
  83. package/svc/FetchService.ts +38 -2
  84. package/svc/JsonBlobService.ts +7 -4
  85. package/svc/README.md +7 -3
  86. package/test-support/agGrid.ts +12 -2
  87. package/test-support/hoistCore.ts +32 -5
  88. package/test-support/index.ts +1 -0
  89. package/test-support/jsonBlobs.ts +543 -0
  90. package/test-support/setup.ts +8 -6
  91. package/test-support/testApp.ts +36 -7
  92. package/build/types/desktop/cmp/tab/impl/TabContextMenuItems.d.ts +0 -4
  93. package/desktop/cmp/tab/impl/TabContextMenuItems.ts +0 -23
package/CHANGELOG.md CHANGED
@@ -11,6 +11,81 @@
11
11
  codebase, or with the symbol itself (`Foo.bar` now ...) when a living API changed behavior.
12
12
  3. Plain ASCII punctuation only. Use " - " for in-sentence breaks, never an em dash.
13
13
  -->
14
+ ## 89.2.0 - 2026-10-20
15
+
16
+ ### 🎁 New Features
17
+
18
+ * Added `FetchOptions.propagateTrace` and `FetchService.defaults.propagateTrace` to choose which
19
+ requests carry a `traceparent` header, with `FetchService.isHoistServerUrl()` as the default.
20
+ * `DashViewSpec.groupName` now nests groups when it separates names with `/`, as in `Charts/Line`.
21
+ The add view menus of `DashContainer` and `DashCanvas` show each level as a submenu, and
22
+ `DashCanvasWidgetChooser` shows each as a card. Existing group names that contain `/` now nest.
23
+ * `DashCanvas` add view menus and `DashCanvasWidgetChooser` now list each group where its first
24
+ view spec appears, as `DashContainer` does, not ahead of all ungrouped specs. To keep groups at
25
+ the top, define grouped specs first.
26
+
27
+ ### 🐞 Bug Fixes
28
+
29
+ * Fixed `ViewManagerModel` reinstalling the prior view when a save of it finished after the user
30
+ selected another view. Auto-save could then write the new view's state into the prior view.
31
+ * Fixed `ViewManagerModel` installing an earlier selected view when it finished loading after a
32
+ later one. A refresh also reloaded the prior view over a newer selection.
33
+ * Fixed `ViewManagerModel` dashboards picking up a change made in the prior view just before a
34
+ switch, which marked the new view dirty. A destroyed `PersistenceProvider` now writes any pending
35
+ change at once.
36
+ * Fixed desktop tab switcher context menus throwing for an `extraMenuItems` entry with a static
37
+ `items` submenu. Items a `prepareFn` adds now also receive the tab in their `actionFn`.
38
+ * Fixed `XH.safeDestroy()` stopping at the first `destroy()` that threw, which left the remaining
39
+ objects - and the rest of a model's managed children - undestroyed. It now logs the error.
40
+
41
+ ### ⚙️ Technical
42
+
43
+ * Added protected `PersistenceProvider.cancelPendingWrite()`. `pushStateToTarget()` now drops any
44
+ pending write. A custom provider that overrides it without calling `super` should call this
45
+ method.
46
+ * `FetchService` now sends the `traceparent` header only to the app's own server, so cross-origin
47
+ requests cannot fail a CORS preflight on it. Set `propagateTrace` to send it elsewhere.
48
+
49
+
50
+ ## 89.1.0 - 2026-10-19
51
+
52
+ ### 🎁 New Features
53
+
54
+ * `Column.DEFAULT_WIDTH` is now 100px, up from 60px, to reduce layout shift when autosizing.
55
+ * Added JsonBlob and ViewManager support to the fake hoist-core in `@xh/hoist/test-support`. App
56
+ specs can now boot an app that creates `ViewManagerModel`s with no setup, and seed views and view
57
+ state with `hoistCore.jsonBlobs`.
58
+ * `NumberInput.displayWithCommas` now accepts `'always'` to insert commas while the user types,
59
+ on desktop and mobile. `'whenBlurred'` names the existing behavior, and `true` remains its alias.
60
+
61
+ ### 🐞 Bug Fixes
62
+
63
+ * Fixed stale records in a `Store` rebound from one Cube `View` to another.
64
+ * Fixed `SelectEditor`, `DateEditor`, and `BooleanEditor` overwriting a cell's value when an edit
65
+ was started by typing a character. `SelectEditor` now enters the character as search text,
66
+ `DateEditor` as typed text, and `BooleanEditor` ignores it.
67
+ * Fixed `XH.jsonBlobService.findAsync()` finding only global blobs. It sent no owner, so it never
68
+ returned a blob owned by the current user, as its docs describe.
69
+ * Fixed desktop `NumberInput` with `min` or `max` rendering blank on mount when its formatted value
70
+ was not a plain number, as with `displayWithCommas` and a value of 1,000 or more, or a
71
+ `valueLabel`. Changing `min` or `max` on such an input could also set its value to 0.
72
+ * Fixed a grouped `Grid` showing its grouped column again on any column state change, such as a
73
+ resize, an autosize or a view restore. A header drag while grouped also saved the column as
74
+ hidden, so it stayed hidden after ungrouping.
75
+ * Fixed `onShowLazy` tabs and other managed refresh contexts replaying a missed auto-refresh as a
76
+ manual refresh when shown. The replay now stays an auto-refresh unless a missed refresh was manual.
77
+ * Fixed a model created with `creates()` re-running `onLinked()` on every render when its component
78
+ had no Hoist model above it, as in a component test rendered at the root.
79
+
80
+ ### 🤖 AI Docs + Tooling
81
+
82
+ * The hoist-react MCP server and `hoist-docs` CLI now serve docs from companion libraries that build
83
+ on Hoist, such as `@xh/hoist-chat-kit` or a client firm's shared package. A library opts in with
84
+ `"hoist": {"docRegistry": "<path>"}` in its `package.json`. Its doc ids take the package name as
85
+ a prefix, and the server instructions name each library. A library can also add guidance for
86
+ agents with `mcpInstructions`, for example which Hoist components it replaces, and keep its
87
+ maintainer docs out of apps with `"mcpAudience": "maintainers"`. See
88
+ [Companion Library Docs](docs/companion-library-docs.md).
14
89
 
15
90
  ## 89.0.1 - 2026-10-14
16
91
 
@@ -673,6 +673,12 @@ export declare class GridModel extends HoistModel {
673
673
  * property is not updated with state changes.
674
674
  */
675
675
  isColumnVisible(colId: string): boolean;
676
+ /**
677
+ * True if ag-Grid is hiding this column because the grid is grouped by it. Hoist leaves the
678
+ * visibility of such a column to ag-Grid, keeping its own `hidden` state for after ungrouping.
679
+ * @internal
680
+ */
681
+ isColumnHiddenByGrouping(colId: string): boolean;
676
682
  setColumnVisible(colId: string, visible: boolean): void;
677
683
  showColumn(colId: string): void;
678
684
  hideColumn(colId: string): void;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Helpers for NumberInput's `displayWithCommas: 'always'` mode, which groups digits while the user
3
+ * types. Commas are the only characters a reformat adds or removes, so the caret is tracked as a
4
+ * count of the non-comma characters before it.
5
+ * @internal
6
+ */
7
+ /**
8
+ * Group the leading integer digits of a partially typed number with commas. Everything after them
9
+ * (decimals, exponent, shorthand unit) is kept as typed.
10
+ */
11
+ export declare function addCommasWhileEditing(value: string): string;
12
+ /** Count of non-comma characters before the caret, or null if the input has no caret. */
13
+ export declare function getCaretSkippingCommas(input: HTMLInputElement): number;
14
+ /** Place the caret after the given count of non-comma characters. */
15
+ export declare function setCaretSkippingCommas(input: HTMLInputElement, count: number): void;
16
+ /**
17
+ * `beforeinput` listener that steps the caret over an adjacent comma before Backspace or Delete, so
18
+ * the key removes the digit beyond it. Otherwise the reformat would restore the deleted comma.
19
+ * Listens for the native event, which (unlike `keydown`) reports deletes from mobile soft keyboards.
20
+ */
21
+ export declare function skipCommaOnDelete(ev: InputEvent): void;
@@ -187,6 +187,8 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
187
187
  * state to the target components when the model's selected `value` changes.
188
188
  */
189
189
  private providers;
190
+ /** Count of calls to {@link loadViewAsync}, used to identify the latest. */
191
+ private viewLoadCount;
190
192
  /** Data access for persisting views. */
191
193
  private dataAccess;
192
194
  get isValueDirty(): boolean;
@@ -254,8 +256,8 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
254
256
  private stateReactions;
255
257
  private loadViewAsync;
256
258
  private maybeAutoSaveAsync;
257
- /** Install a saved view, keeping as pending any value set while the save was in flight. */
258
- private setAsSavedView;
259
+ /** Apply a completed save, installing the saved view only if it is still current. */
260
+ private applySavedView;
259
261
  private setAsView;
260
262
  private handleException;
261
263
  private noteSuccess;
@@ -466,7 +466,8 @@ export declare class XHApi {
466
466
  restoreDefaultsAsync(): Promise<void>;
467
467
  /**
468
468
  * Helper method to destroy resources safely (e.g. child HoistModels). Will quietly skip args
469
- * that are null / undefined or that do not implement destroy().
469
+ * that are null / undefined or that do not implement destroy(). Logs, rather than throws, an
470
+ * error from any destroy(), so the remaining args are still destroyed.
470
471
  *
471
472
  * @param args - objects to be destroyed. If any argument is an array, each top-level element
472
473
  * in the array will be destroyed. (Note this is *not* done recursively.)
@@ -110,6 +110,7 @@ export declare abstract class HoistModel extends HoistBase implements Loadable {
110
110
  static get isHoistModel(): boolean;
111
111
  get isHoistModel(): boolean;
112
112
  accessor _componentProps: DefaultHoistProps | null;
113
+ _linked: boolean;
113
114
  _modelLookup: any;
114
115
  _created: number;
115
116
  constructor();
@@ -17,6 +17,7 @@ export declare class ManagedRefreshContextModel extends RefreshContextModel {
17
17
  xhImpl: boolean;
18
18
  model: ManagedRefreshTarget;
19
19
  refreshPending: boolean;
20
+ private pendingIsAutoRefresh;
20
21
  constructor(model: ManagedRefreshTarget);
21
22
  doLoadAsync(loadSpec: LoadSpec): Promise<void>;
22
23
  noteActiveChanged(isActive: boolean): void;
@@ -81,6 +81,8 @@ export declare abstract class PersistenceProvider<S = any> {
81
81
  protected writeInternal(data: S): void;
82
82
  protected writeRaw(obj: Record<typeof this.path, S>): void;
83
83
  protected readRaw(): Record<typeof this.path, S>;
84
+ /** Drop any debounced write still pending. */
85
+ protected cancelPendingWrite(): void;
84
86
  /**
85
87
  * Resolve the PersistenceProvider class that the given options would produce, applying the
86
88
  * same precedence used by {@link create}. Throws if the options do not resolve to a known
@@ -93,6 +95,7 @@ export declare abstract class PersistenceProvider<S = any> {
93
95
  * @internal - not intended for application use.
94
96
  */
95
97
  static parseProviderClass<S>(opts: PersistOptions): Class<PersistenceProvider<S>, [PersistenceProviderConfig<S>]>;
98
+ private get debouncedWrite();
96
99
  private ensureValid;
97
100
  }
98
101
  export {};
@@ -97,7 +97,6 @@ export declare class View extends HoistBase implements FilterBindTarget, FilterV
97
97
  private _bucketDependentFields;
98
98
  private _fieldsByName;
99
99
  private _rowDataGenerator;
100
- _rowDigest: number;
101
100
  _aggFieldsByDepth: CubeField[][];
102
101
  _aggFieldNamesByDepth: Set<string>[];
103
102
  _canAggregateFnFieldsByDepth: CubeField[][];
@@ -149,7 +148,6 @@ export declare class View extends HoistBase implements FilterBindTarget, FilterV
149
148
  * @internal
150
149
  */
151
150
  newLeafRowData(id: string, src: PlainObject): ViewRowData;
152
- assignDigest(data: ViewRowData): void;
153
151
  private buildIndices;
154
152
  private fullUpdate;
155
153
  private dataOnlyUpdate;
@@ -1,5 +1,5 @@
1
1
  import type { StoreRecord } from '@xh/hoist/data';
2
- import type { BaseRow } from '../row/BaseRow';
2
+ import { BaseRow } from '../row/BaseRow';
3
3
  import type { View } from '../View';
4
4
  /**
5
5
  * Cache of the BaseRows generated by a View, allowing rows - with their published data objects
@@ -9,6 +9,11 @@ import type { ParentRow } from './ParentRow';
9
9
  * @internal
10
10
  */
11
11
  export declare abstract class BaseRow implements ViewRow {
12
+ private static lastDigest;
13
+ /** The latest cubeRowDigest stamp given out by any View. */
14
+ static get currentDigest(): number;
15
+ /** Stamp row data with a new cubeRowDigest, marking it changed. */
16
+ static assignDigest(data: ViewRowData): void;
12
17
  readonly view: View;
13
18
  readonly id: string;
14
19
  data: PlainObject;
@@ -17,7 +17,8 @@ export interface DashViewSpec {
17
17
  icon?: ReactElement;
18
18
  /**
19
19
  * Group name to display within the add view component. The default context menu will
20
- * automatically group its available views if provided.
20
+ * automatically group its available views if provided. Separate names with '/' to nest
21
+ * groups - e.g. `Charts/Line`.
21
22
  */
22
23
  groupName?: string;
23
24
  /**
@@ -2,7 +2,7 @@
2
2
  * Context menu to add items to a DashCanvas
3
3
  *
4
4
  * Available view specs are listed in their defined order, optionally
5
- * grouped by their 'groupName' property
5
+ * grouped by their `groupName` property into (nested) submenus.
6
6
  * @internal
7
7
  */
8
8
  export declare const dashCanvasContextMenu: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<import("@xh/hoist/core").HoistModel>>;
@@ -7,7 +7,8 @@ export interface DashCanvasWidgetChooserProps extends HoistProps, TestSupportPro
7
7
  }
8
8
  /**
9
9
  * Displays available {@link DashCanvasViewSpec}s as draggable items that can be dropped onto a
10
- * {@link DashCanvas} to add new views. View specs are listed in their defined order, grouped by
11
- * their `groupName` property if present. Place inside a collapsible panel alongside a DashCanvas.
10
+ * {@link DashCanvas} to add new views. View specs are listed in their defined order, grouped into
11
+ * (nested) cards by their `groupName` property if present. Place inside a collapsible panel
12
+ * alongside a DashCanvas.
12
13
  */
13
14
  export declare const DashCanvasWidgetChooser: import("react").FC<DashCanvasWidgetChooserProps>, dashCanvasWidgetChooser: import("@xh/hoist/core").ElementFactory<DashCanvasWidgetChooserProps>;
@@ -3,7 +3,7 @@ import { DashContainerModel } from '../DashContainerModel';
3
3
  * Context menu for title bar/tabs of a stack in a DashContainer.
4
4
  *
5
5
  * Available view specs are listed in their defined order, optionally
6
- * grouped by their `groupName` property
6
+ * grouped by their `groupName` property into (nested) submenus.
7
7
  *
8
8
  * @internal
9
9
  */
@@ -0,0 +1,35 @@
1
+ import type { MenuItem, MenuItemLike } from '@xh/hoist/core';
2
+ import type { DashViewSpec } from '../DashViewSpec';
3
+ /**
4
+ * A group of view specs, built from their `groupName`. A slash-delimited name nests groups - e.g.
5
+ * a spec with `groupName: 'Charts/Line'` sits in group 'Line', within group 'Charts'.
6
+ * @internal
7
+ */
8
+ export declare class ViewSpecGroup<T extends DashViewSpec = DashViewSpec> {
9
+ /** One segment of a `groupName` - the name shown for this group. */
10
+ readonly name: string;
11
+ /** Nested groups and view specs, in the order each first appears in the source specs. */
12
+ readonly children: ViewSpecNode<T>[];
13
+ constructor(name: string);
14
+ /** All view specs within this group, including those within its nested groups. */
15
+ get allViewSpecs(): T[];
16
+ }
17
+ /** @internal */
18
+ export type ViewSpecNode<T extends DashViewSpec = DashViewSpec> = ViewSpecGroup<T> | T;
19
+ /**
20
+ * Arrange view specs into groups by their `groupName`, split on '/' into nested groups. Blank
21
+ * segments are ignored and surrounding spaces trimmed, so `Charts / Line` matches `Charts/Line`.
22
+ *
23
+ * @returns top-level groups and ungrouped specs, in the order each first appears.
24
+ * @internal
25
+ */
26
+ export declare function groupViewSpecs<T extends DashViewSpec>(viewSpecs: T[]): ViewSpecNode<T>[];
27
+ /**
28
+ * Create menu items for adding views, nesting specs into submenus by their `groupName`. Groups
29
+ * and specs are listed in the order each first appears.
30
+ *
31
+ * @param viewSpecs - specs to list, in their defined order.
32
+ * @param createItem - creates the menu item for a single spec.
33
+ * @internal
34
+ */
35
+ export declare function createViewSpecMenuItems<T extends DashViewSpec>(viewSpecs: T[], createItem: (viewSpec: T) => MenuItem): MenuItemLike[];
@@ -1,3 +1,4 @@
1
+ import { HoistInputModel } from '@xh/hoist/cmp/input';
1
2
  import { ElementFactory } from '@xh/hoist/core';
2
3
  import { EditorProps } from '@xh/hoist/desktop/cmp/grid/editors/EditorProps';
3
4
  import { ForwardedRef, ReactElement } from 'react';
@@ -11,5 +12,9 @@ import { ForwardedRef, ReactElement } from 'react';
11
12
  * @param component - ElementFactory for HoistInput to render.
12
13
  * @param props - props passed to containing component
13
14
  * @param ref - forwardRef passed to containing component
15
+ * @param applyInitialKey - applies a printable key that started the edit to the focused input.
16
+ * Defaults to entering the key as the input's value.
14
17
  */
15
- export declare function useInlineEditorModel(component: ElementFactory, props: EditorProps<any>, ref: ForwardedRef<any>): ReactElement;
18
+ export declare function useInlineEditorModel(component: ElementFactory, props: EditorProps<any>, ref: ForwardedRef<any>, applyInitialKey?: InitialKeyFn): ReactElement;
19
+ /** Applies the printable key that started an edit to the editor's focused input. */
20
+ export type InitialKeyFn = (input: HoistInputModel, key: string) => void;
@@ -10,8 +10,11 @@ export interface NumberInputProps extends HoistProps, LayoutProps, StyleProps, H
10
10
  autoFocus?: boolean;
11
11
  /** True to commit on every change/keystroke, default false. */
12
12
  commitOnChange?: boolean;
13
- /** True to insert commas in displayed value. */
14
- displayWithCommas?: boolean;
13
+ /**
14
+ * Insert commas in displayed value - 'whenBlurred' (or true) to show them only when the input
15
+ * does not have focus, 'always' to also show them while the user types.
16
+ */
17
+ displayWithCommas?: boolean | 'always' | 'whenBlurred';
15
18
  /** True to convert entries suffixed with k/m/b to thousands/millions/billions. */
16
19
  enableShorthandUnits?: boolean;
17
20
  /** Ref handler that receives HTML <input> element backing this component. */
@@ -1,7 +1,6 @@
1
1
  import { TabContainerModel, TabModel } from '@xh/hoist/cmp/tab';
2
2
  import { IDynamicTabSwitcherModel, TabSwitcherConfig, TabSwitcherMenuContext } from '@xh/hoist/cmp/tab/Types';
3
3
  import { HoistModel, MenuItemLike, MenuToken } from '@xh/hoist/core';
4
- import React from 'react';
5
4
  /**
6
5
  * State management for the DynamicTabSwitcher component.
7
6
  * @internal
@@ -20,7 +19,7 @@ export declare class DynamicTabSwitcherModel extends HoistModel implements IDyna
20
19
  toggleTabFavorite(tabId: string): void;
21
20
  activate(tabId: string): void;
22
21
  hide(tabId: string): void;
23
- getContextMenuItems(e: React.MouseEvent<HTMLDivElement, MouseEvent>, tab: TabModel): Array<MenuItemLike<MenuToken, TabSwitcherMenuContext>>;
22
+ getContextMenuItems(tab: TabModel): Array<MenuItemLike<MenuToken, TabSwitcherMenuContext>>;
24
23
  setFavoriteTabIds(tabIds: string[]): void;
25
24
  onDragEnd(result: any): void;
26
25
  private activeTabReaction;
@@ -8,8 +8,11 @@ export interface NumberInputProps extends HoistProps, HoistInputProps, PasswordM
8
8
  value?: number;
9
9
  /** True to commit on every change/keystroke, default false. */
10
10
  commitOnChange?: boolean;
11
- /** True to insert commas in displayed value. */
12
- displayWithCommas?: boolean;
11
+ /**
12
+ * Insert commas in displayed value - 'whenBlurred' (or true) to show them only when the input
13
+ * does not have focus, 'always' to also show them while the user types.
14
+ */
15
+ displayWithCommas?: boolean | 'always' | 'whenBlurred';
13
16
  /** True to convert entries suffixed with k/m/b to thousands/millions/billions. */
14
17
  enableShorthandUnits?: boolean;
15
18
  /**
@@ -7,6 +7,7 @@ export interface FetchServiceDefaults {
7
7
  autoGenCorrelationIds?: boolean | ((opts: FetchOptions) => boolean);
8
8
  correlationIdHeaderKey?: string;
9
9
  genCorrelationId?: () => string;
10
+ propagateTrace?: boolean | ((opts: FetchOptions) => boolean);
10
11
  }
11
12
  /**
12
13
  * Service for making managed HTTP requests, both to the app's own Hoist server and to remote APIs.
@@ -23,6 +24,8 @@ export interface FetchServiceDefaults {
23
24
  * - Configurable timeouts (default 30s) via {@link FetchOptions.timeout}
24
25
  * - Auto-abort of duplicate in-flight requests via {@link FetchOptions.autoAbortKey}
25
26
  * - Optional correlation IDs for request tracking (see `defaults.autoGenCorrelationIds`)
27
+ * - W3C `traceparent` headers when tracing is enabled, sent by default only to the app's own
28
+ * server (see `defaults.propagateTrace` and {@link FetchOptions.propagateTrace})
26
29
  * - Request/response interceptors via {@link addInterceptor}
27
30
  * - Default headers for all requests via {@link addDefaultHeaders}
28
31
  * - Rich exception handling with HTTP status, server messages, and trace IDs
@@ -35,6 +38,11 @@ export declare class FetchService extends HoistService {
35
38
  static instance: FetchService;
36
39
  /** App-level defaults for FetchService. Instance options take precedence. */
37
40
  static defaults: FetchServiceDefaults;
41
+ /**
42
+ * Does a request url target the app's own server? True for relative and root-relative urls,
43
+ * and for absolute urls on the origin of the page or of {@link XH.baseUrl}.
44
+ */
45
+ static isHoistServerUrl(url: string): boolean;
38
46
  NO_JSON_RESPONSES: StatusCodes[];
39
47
  /**
40
48
  * Regex applied during failed response handling to determine if contentType indicates JSON.
@@ -177,6 +185,7 @@ export declare class FetchService extends HoistService {
177
185
  private withCorrelationId;
178
186
  private withTraceId;
179
187
  private withResolvedHeadersAsync;
188
+ private shouldPropagateTrace;
180
189
  private managedFetchAsync;
181
190
  private abortableFetchAsync;
182
191
  private parseJsonAsync;
@@ -263,6 +272,16 @@ export interface FetchOptions {
263
272
  * `correlationId` will be set. If `true`, one will be auto-generated.
264
273
  */
265
274
  correlationId?: string | boolean;
275
+ /**
276
+ * True to send a W3C `traceparent` header with this request, false to omit it. Applies only
277
+ * when tracing is enabled. The request still records a client span either way, but only a
278
+ * server that receives the header can join the trace. Defaults to
279
+ * `FetchService.defaults.propagateTrace`, which sends the header only to the app's own server.
280
+ *
281
+ * Note `traceparent` is not a CORS-safelisted header. A cross-origin server must list it in
282
+ * `Access-Control-Allow-Headers`, or the browser blocks the request.
283
+ */
284
+ propagateTrace?: boolean;
266
285
  /**
267
286
  * Parameters to encode and append as a query string, or send with the request body
268
287
  * (for POSTs/PUTs sending form-url-encoded).
@@ -11,5 +11,7 @@
11
11
  * ag-Grid renders its header, rows and cells in jsdom, which has no layout. Every row and column
12
12
  * renders regardless of the viewport, so virtualisation cannot be observed here, and measured
13
13
  * sizes read back as zero. Inline styles and CSS variables can be read as set.
14
+ *
15
+ * Throws if the installed ag-Grid is outside the range Hoist supports.
14
16
  */
15
17
  export declare function installAgGridForTests(): void;
@@ -1,5 +1,6 @@
1
1
  import { type PlainObject } from '@xh/hoist/core';
2
2
  import { type HttpHandler } from 'msw';
3
+ import { FakeJsonBlobStore } from './jsonBlobs';
3
4
  /** URL prefix for Hoist server calls - `XH.baseUrl`, from the `xhBaseUrl` build constant. */
4
5
  export declare const BASE_URL: string;
5
6
  /** A request served by the fake, recorded so tests can assert what the client sent. */
@@ -84,9 +85,14 @@ export declare class FakeHoistCore {
84
85
  * each zone's offset when it answers, as hoist-core does.
85
86
  */
86
87
  environment: PlainObject;
88
+ /** JsonBlobs, including ViewManager views and each user's view state. Starts empty. */
89
+ readonly jsonBlobs: FakeJsonBlobStore;
87
90
  /** Every request the fake has served in this test - the kit's setup clears it before each. */
88
91
  requests: RecordedRequest[];
89
- /** @internal - called with a message when a route throws. The kit's setup fails the test. */
92
+ /**
93
+ * @internal - called with a message for each problem the kit's guards catch, such as a route
94
+ * that throws. The kit's setup fails the running test, or `initTestAppAsync()` the boot.
95
+ */
90
96
  onProblem: (msg: string) => void;
91
97
  private routes;
92
98
  private testRouteCount;
@@ -3,4 +3,5 @@
3
3
  * See docs/unit-testing.md.
4
4
  */
5
5
  export * from './hoistCore';
6
+ export { type FakeJsonBlob, FakeJsonBlobStore, type JsonBlobSpec, type ViewSpec } from './jsonBlobs';
6
7
  export * from './testApp';
@@ -0,0 +1,130 @@
1
+ import type { ViewUserState } from '@xh/hoist/cmp/viewmanager';
2
+ import type { PlainObject } from '@xh/hoist/core';
3
+ import type { JsonBlob } from '@xh/hoist/svc';
4
+ import type { FakeHoistCore, HoistError } from './hoistCore';
5
+ /** A JsonBlob as the fake stores it. `meta` is always an object, or null. */
6
+ export interface FakeJsonBlob extends JsonBlob {
7
+ meta: PlainObject;
8
+ }
9
+ /** A JsonBlob to add to the fake, with the fields `JsonBlobService.create` stores. */
10
+ export interface JsonBlobSpec {
11
+ type: string;
12
+ name: string;
13
+ /** Defaults to an empty object. */
14
+ value?: any;
15
+ /** Defaults to the current user. Pass `null` for a global blob. */
16
+ owner?: string;
17
+ /** `'*'` to let every user read the blob. */
18
+ acl?: '*';
19
+ meta?: PlainObject;
20
+ description?: string;
21
+ /** Defaults to a generated token. */
22
+ token?: string;
23
+ }
24
+ /** A ViewManager view to add to the fake, as `ViewService.create` stores it. */
25
+ export interface ViewSpec {
26
+ /** The `type` of the `ViewManagerModel` that loads the view. */
27
+ type: string;
28
+ name: string;
29
+ /** Defaults to an empty object. */
30
+ value?: PlainObject;
31
+ group?: string;
32
+ description?: string;
33
+ /** True to let every user read the view. */
34
+ isShared?: boolean;
35
+ /** True for a global view, which has no owner. */
36
+ isGlobal?: boolean;
37
+ /** Defaults to the current user. Ignored for a global view. */
38
+ owner?: string;
39
+ /** Defaults to a generated token. */
40
+ token?: string;
41
+ }
42
+ /**
43
+ * The JsonBlobs on the fake hoist-core, including ViewManager views and view state. Use the
44
+ * `hoistCore.jsonBlobs` instance. The store starts empty, so a `ViewManagerModel` loads no views
45
+ * and selects its in-code default.
46
+ */
47
+ export declare class FakeJsonBlobStore {
48
+ private readonly core;
49
+ /**
50
+ * Roles that may write global blobs, by blob type, with `*` for any type not listed - as in
51
+ * hoist-core's `xhJsonBlobConfig`. A view manager reports `manageGlobal` from these and
52
+ * `hoistCore.roles`. List the role `*` to allow every user.
53
+ */
54
+ globalWriteRoles: Record<string, string[]>;
55
+ private blobs;
56
+ private nextId;
57
+ constructor(core: FakeHoistCore);
58
+ /** Add a blob, as `JsonBlobService.create` stores it. Returns the stored blob. */
59
+ add(spec: JsonBlobSpec): FakeJsonBlob;
60
+ /** Add a ViewManager view, as `ViewService.create` stores it. Returns the stored blob. */
61
+ addView(spec: ViewSpec): FakeJsonBlob;
62
+ /**
63
+ * Set the current user's state for one view type, as `ViewService.updateState` saves it.
64
+ * Changes only the keys given.
65
+ *
66
+ * @param opts - `viewInstance`, the `instance` of the view manager whose current view is
67
+ * set. Defaults to 'default'.
68
+ */
69
+ setViewState(type: string, state: Partial<ViewUserState>, opts?: {
70
+ viewInstance?: string;
71
+ }): void;
72
+ /** The current user's state for one view type, as the server sends it to a view manager. */
73
+ viewState(type: string, viewInstance?: string): ViewUserState;
74
+ /**
75
+ * The stored blob with a token, archived or not. Change it to model an edit made elsewhere,
76
+ * e.g. advance `lastUpdated` to model a save by another session.
77
+ */
78
+ get(token: string): FakeJsonBlob;
79
+ /** Remove every blob. */
80
+ clear(): void;
81
+ /** @internal - empty the store and restore the default `globalWriteRoles`. */
82
+ reset(): void;
83
+ /**
84
+ * @internal - remove the current user's view state for every type, as hoist-core's
85
+ * `xh/clearUserState` does through `ViewService.clearAllState`.
86
+ */
87
+ clearViewState(): void;
88
+ /** @internal - the endpoints served by `serve()`, relative to `XH.baseUrl`. */
89
+ get paths(): string[];
90
+ /**
91
+ * @internal - answer a request to one of `paths`. Returns the response body, or undefined for
92
+ * an empty 204. Throws a `FakeServerError` for an error response.
93
+ *
94
+ * @param params - the query string and form body merged, as Grails `params` read them.
95
+ * @param json - the parsed JSON body, if any.
96
+ */
97
+ serve(path: string, params: PlainObject, json: any): unknown;
98
+ private endpoints;
99
+ private getAllData;
100
+ private updateState;
101
+ private createView;
102
+ private updateViewInfo;
103
+ private bulkUpdateViewInfo;
104
+ private deleteViews;
105
+ private applyViewInfo;
106
+ private updatePinned;
107
+ private insertView;
108
+ private insertState;
109
+ private getBlob;
110
+ private findBlob;
111
+ private listBlobs;
112
+ private createBlob;
113
+ private updateBlob;
114
+ private createOrUpdateBlob;
115
+ private archiveBlob;
116
+ private renameGroup;
117
+ private canRead;
118
+ private ensureReadable;
119
+ private canWriteGlobal;
120
+ private insert;
121
+ private newToken;
122
+ }
123
+ /**
124
+ * @internal - an error that the fake renders as hoist-core would, with `hoistError()`.
125
+ */
126
+ export declare class FakeServerError extends Error {
127
+ readonly status: number;
128
+ readonly error: HoistError;
129
+ constructor(status: number, error: HoistError);
130
+ }
@@ -11,8 +11,11 @@ export type TestAppSpec = Partial<ConstructorParameters<typeof AppSpec>[0]>;
11
11
  * graph, and with it a fresh `XH`. Adjust `hoistCore` state first to boot against other server
12
12
  * data (e.g. `hoistCore.configs.myConfig = 42`).
13
13
  *
14
- * Resolves once the app is `RUNNING`. Rejects, naming `XH.appState`, if boot stops anywhere else -
15
- * `ACCESS_DENIED`, `LOAD_FAILED`, or `LOGIN_REQUIRED`, where boot waits for the user to sign in.
14
+ * Resolves once the app is `RUNNING` and the requests boot started have finished. Rejects, naming
15
+ * `XH.appState`, if boot stops anywhere else - `ACCESS_DENIED`, `LOAD_FAILED`, or
16
+ * `LOGIN_REQUIRED`, where boot waits for the user to sign in. Also rejects if boot triggers a
17
+ * problem that the kit's guards catch, such as a request the fake does not handle. Logs any error
18
+ * that the app handles during boot.
16
19
  *
17
20
  * @param spec - overrides for the test app's `AppSpec`. Defaults to a desktop app with a minimal
18
21
  * app model, open to any user. Pass `checkAccess` to require a role.
package/cmp/grid/Grid.ts CHANGED
@@ -442,7 +442,7 @@ export class GridLocalModel extends HoistModel {
442
442
 
443
443
  // Re-assert configured visibility - AG Grid re-shows a column when ungrouped (#4473).
444
444
  const state = model.columnState
445
- .filter(({colId}) => !groupBy.includes(colId))
445
+ .filter(({colId}) => !model.isColumnHiddenByGrouping(colId))
446
446
  .map(({colId, hidden}) => ({colId, hide: hidden}));
447
447
  agApi.applyColumnState({state});
448
448
  }
@@ -523,7 +523,7 @@ export class GridLocalModel extends HoistModel {
523
523
  hasChanges = true;
524
524
  }
525
525
 
526
- if (agCol.hide !== hidden) {
526
+ if (agCol.hide !== hidden && !model.isColumnHiddenByGrouping(colId)) {
527
527
  ret.hide = hidden;
528
528
  hasChanges = true;
529
529
  }