@xh/hoist 89.0.1 → 90.0.0-SNAPSHOT.1792498946334

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 (75) hide show
  1. package/CHANGELOG.md +50 -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/core/model/HoistModel.d.ts +1 -0
  5. package/build/types/core/model/ManagedRefreshContextModel.d.ts +1 -0
  6. package/build/types/data/cube/View.d.ts +0 -2
  7. package/build/types/data/cube/impl/RowCache.d.ts +1 -1
  8. package/build/types/data/cube/row/BaseRow.d.ts +5 -0
  9. package/build/types/desktop/cmp/dash/DashViewSpec.d.ts +2 -1
  10. package/build/types/desktop/cmp/dash/canvas/impl/DashCanvasContextMenu.d.ts +1 -1
  11. package/build/types/desktop/cmp/dash/canvas/widgetchooser/DashCanvasWidgetChooser.d.ts +3 -2
  12. package/build/types/desktop/cmp/dash/container/impl/DashContainerContextMenu.d.ts +1 -1
  13. package/build/types/desktop/cmp/dash/impl/DashUtils.d.ts +35 -0
  14. package/build/types/desktop/cmp/grid/editors/impl/InlineEditorModel.d.ts +6 -1
  15. package/build/types/desktop/cmp/input/NumberInput.d.ts +5 -2
  16. package/build/types/mobile/cmp/input/NumberInput.d.ts +5 -2
  17. package/build/types/test-support/agGrid.d.ts +2 -0
  18. package/build/types/test-support/hoistCore.d.ts +7 -1
  19. package/build/types/test-support/index.d.ts +1 -0
  20. package/build/types/test-support/jsonBlobs.d.ts +130 -0
  21. package/build/types/test-support/testApp.d.ts +5 -2
  22. package/cmp/grid/Grid.ts +2 -2
  23. package/cmp/grid/GridModel.ts +14 -1
  24. package/cmp/grid/columns/Column.ts +3 -2
  25. package/cmp/input/impl/LiveCommas.ts +59 -0
  26. package/core/model/HoistModel.ts +4 -2
  27. package/core/model/Hooks.ts +1 -0
  28. package/core/model/ManagedRefreshContextModel.ts +5 -1
  29. package/data/cube/View.ts +3 -9
  30. package/data/cube/impl/RowCache.ts +2 -2
  31. package/data/cube/row/BaseRow.ts +14 -1
  32. package/data/cube/row/ParentRow.ts +1 -1
  33. package/desktop/cmp/dash/DashViewSpec.ts +2 -1
  34. package/desktop/cmp/dash/README.md +6 -5
  35. package/desktop/cmp/dash/canvas/impl/DashCanvasContextMenu.ts +1 -1
  36. package/desktop/cmp/dash/canvas/impl/utils.ts +16 -51
  37. package/desktop/cmp/dash/canvas/widgetchooser/DashCanvasWidgetChooser.ts +37 -54
  38. package/desktop/cmp/dash/container/impl/DashContainerContextMenu.ts +8 -39
  39. package/desktop/cmp/dash/impl/DashUtils.ts +90 -0
  40. package/desktop/cmp/grid/editors/BooleanEditor.ts +2 -1
  41. package/desktop/cmp/grid/editors/DateEditor.ts +4 -1
  42. package/desktop/cmp/grid/editors/SelectEditor.ts +4 -1
  43. package/desktop/cmp/grid/editors/impl/InlineEditorModel.ts +17 -5
  44. package/desktop/cmp/input/NumberInput.ts +51 -12
  45. package/desktop/cmp/input/Select.ts +25 -7
  46. package/docs/README.md +2 -0
  47. package/docs/build-and-publish.md +21 -11
  48. package/docs/companion-library-docs.md +205 -0
  49. package/docs/doc-registry.json +9 -1
  50. package/docs/lifecycle-app.md +17 -0
  51. package/docs/unit-testing.md +54 -3
  52. package/docs/upgrade-notes/v89-upgrade-notes.md +7 -1
  53. package/docs/version-compatibility.md +2 -1
  54. package/icon/README.md +4 -1
  55. package/mcp/README.md +79 -4
  56. package/mcp/cli/docs.ts +75 -30
  57. package/mcp/data/doc-id-resolver.ts +50 -9
  58. package/mcp/data/doc-registry.ts +462 -44
  59. package/mcp/data/doc-search.ts +25 -6
  60. package/mcp/formatters/docs.ts +136 -36
  61. package/mcp/instructions.ts +69 -0
  62. package/mcp/resources/docs.ts +10 -8
  63. package/mcp/server.ts +7 -13
  64. package/mcp/tools/docs.ts +64 -18
  65. package/mcp/util/paths.ts +85 -2
  66. package/mobile/cmp/input/NumberInput.ts +42 -4
  67. package/package.json +19 -19
  68. package/public/msal-redirect-bridge.min.js +1 -1
  69. package/svc/JsonBlobService.ts +7 -4
  70. package/test-support/agGrid.ts +12 -2
  71. package/test-support/hoistCore.ts +32 -5
  72. package/test-support/index.ts +1 -0
  73. package/test-support/jsonBlobs.ts +543 -0
  74. package/test-support/setup.ts +8 -6
  75. package/test-support/testApp.ts +36 -7
package/CHANGELOG.md CHANGED
@@ -11,6 +11,56 @@
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
+ ## 90.0.0-SNAPSHOT - unreleased
15
+
16
+ ### 🎁 New Features
17
+
18
+ * `DashViewSpec.groupName` now nests groups when it separates names with `/`, as in `Charts/Line`.
19
+ The add view menus of `DashContainer` and `DashCanvas` show each level as a submenu, and
20
+ `DashCanvasWidgetChooser` shows each as a card. Existing group names that contain `/` now nest.
21
+ * `DashCanvas` add view menus and `DashCanvasWidgetChooser` now list each group where its first
22
+ view spec appears, as `DashContainer` does, not ahead of all ungrouped specs. To keep groups at
23
+ the top, define grouped specs first.
24
+
25
+ ## 89.1.0 - 2026-10-19
26
+
27
+ ### 🎁 New Features
28
+
29
+ * `Column.DEFAULT_WIDTH` is now 100px, up from 60px, to reduce layout shift when autosizing.
30
+ * Added JsonBlob and ViewManager support to the fake hoist-core in `@xh/hoist/test-support`. App
31
+ specs can now boot an app that creates `ViewManagerModel`s with no setup, and seed views and view
32
+ state with `hoistCore.jsonBlobs`.
33
+ * `NumberInput.displayWithCommas` now accepts `'always'` to insert commas while the user types,
34
+ on desktop and mobile. `'whenBlurred'` names the existing behavior, and `true` remains its alias.
35
+
36
+ ### 🐞 Bug Fixes
37
+
38
+ * Fixed stale records in a `Store` rebound from one Cube `View` to another.
39
+ * Fixed `SelectEditor`, `DateEditor`, and `BooleanEditor` overwriting a cell's value when an edit
40
+ was started by typing a character. `SelectEditor` now enters the character as search text,
41
+ `DateEditor` as typed text, and `BooleanEditor` ignores it.
42
+ * Fixed `XH.jsonBlobService.findAsync()` finding only global blobs. It sent no owner, so it never
43
+ returned a blob owned by the current user, as its docs describe.
44
+ * Fixed desktop `NumberInput` with `min` or `max` rendering blank on mount when its formatted value
45
+ was not a plain number, as with `displayWithCommas` and a value of 1,000 or more, or a
46
+ `valueLabel`. Changing `min` or `max` on such an input could also set its value to 0.
47
+ * Fixed a grouped `Grid` showing its grouped column again on any column state change, such as a
48
+ resize, an autosize or a view restore. A header drag while grouped also saved the column as
49
+ hidden, so it stayed hidden after ungrouping.
50
+ * Fixed `onShowLazy` tabs and other managed refresh contexts replaying a missed auto-refresh as a
51
+ manual refresh when shown. The replay now stays an auto-refresh unless a missed refresh was manual.
52
+ * Fixed a model created with `creates()` re-running `onLinked()` on every render when its component
53
+ had no Hoist model above it, as in a component test rendered at the root.
54
+
55
+ ### 🤖 AI Docs + Tooling
56
+
57
+ * The hoist-react MCP server and `hoist-docs` CLI now serve docs from companion libraries that build
58
+ on Hoist, such as `@xh/hoist-chat-kit` or a client firm's shared package. A library opts in with
59
+ `"hoist": {"docRegistry": "<path>"}` in its `package.json`. Its doc ids take the package name as
60
+ a prefix, and the server instructions name each library. A library can also add guidance for
61
+ agents with `mcpInstructions`, for example which Hoist components it replaces, and keep its
62
+ maintainer docs out of apps with `"mcpAudience": "maintainers"`. See
63
+ [Companion Library Docs](docs/companion-library-docs.md).
14
64
 
15
65
  ## 89.0.1 - 2026-10-14
16
66
 
@@ -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;
@@ -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;
@@ -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. */
@@ -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
  /**
@@ -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
  }
@@ -1439,7 +1439,7 @@ export class GridModel extends HoistModel {
1439
1439
  return {
1440
1440
  colId,
1441
1441
  pinned: isBoolean(pinned) ? (pinned ? 'left' : null) : pinned,
1442
- hidden: !!hide,
1442
+ hidden: this.isColumnHiddenByGrouping(colId) ? null : !!hide,
1443
1443
  width: col.flex ? undefined : width
1444
1444
  };
1445
1445
  }
@@ -1590,6 +1590,19 @@ export class GridModel extends HoistModel {
1590
1590
  return state ? !state.hidden : false;
1591
1591
  }
1592
1592
 
1593
+ /**
1594
+ * True if ag-Grid is hiding this column because the grid is grouped by it. Hoist leaves the
1595
+ * visibility of such a column to ag-Grid, keeping its own `hidden` state for after ungrouping.
1596
+ * @internal
1597
+ */
1598
+ isColumnHiddenByGrouping(colId: string): boolean {
1599
+ const {agApi} = this;
1600
+ if (!agApi || !this.groupBy.includes(colId)) return false;
1601
+
1602
+ const suppress = agApi.getGridOption('suppressGroupChangesColumnVisibility');
1603
+ return suppress !== true && suppress !== 'suppressHideOnGroup';
1604
+ }
1605
+
1593
1606
  setColumnVisible(colId: string, visible: boolean) {
1594
1607
  this.updateColumnState([{colId, hidden: !visible}]);
1595
1608
  }
@@ -473,7 +473,7 @@ export interface ColumnSpec {
473
473
  * @mcpHint column configuration for grids
474
474
  */
475
475
  export class Column {
476
- static DEFAULT_WIDTH = 60;
476
+ static DEFAULT_WIDTH = 100;
477
477
  static FLEX_COL_MIN_WIDTH = 30;
478
478
 
479
479
  /**
@@ -807,7 +807,8 @@ export class Column {
807
807
  },
808
808
  headerClass: getAgHeaderClassFn(this),
809
809
  headerTooltip: this.headerTooltip,
810
- hide: this.hidden,
810
+ // Undefined keeps ag-Grid's current visibility on update.
811
+ hide: gridModel.isColumnHiddenByGrouping(this.colId) ? undefined : this.hidden,
811
812
  columnGroupShow: toAgColumnGroupShow(this.groupShowMode),
812
813
  minWidth: this.minWidth,
813
814
  maxWidth: this.maxWidth,
@@ -0,0 +1,59 @@
1
+ /*
2
+ * This file belongs to Hoist, an application development toolkit
3
+ * developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
4
+ *
5
+ * Copyright © 2026 Extremely Heavy Industries Inc.
6
+ */
7
+
8
+ /**
9
+ * Helpers for NumberInput's `displayWithCommas: 'always'` mode, which groups digits while the user
10
+ * types. Commas are the only characters a reformat adds or removes, so the caret is tracked as a
11
+ * count of the non-comma characters before it.
12
+ * @internal
13
+ */
14
+
15
+ /**
16
+ * Group the leading integer digits of a partially typed number with commas. Everything after them
17
+ * (decimals, exponent, shorthand unit) is kept as typed.
18
+ */
19
+ export function addCommasWhileEditing(value: string): string {
20
+ return value
21
+ .replace(/,/g, '')
22
+ .replace(
23
+ /^(\s*[-+]?)(\d+)/,
24
+ (_, sign, digits) => sign + digits.replace(/\B(?=(\d{3})+$)/g, ',')
25
+ );
26
+ }
27
+
28
+ /** Count of non-comma characters before the caret, or null if the input has no caret. */
29
+ export function getCaretSkippingCommas(input: HTMLInputElement): number {
30
+ const {selectionStart, value} = input;
31
+ return selectionStart == null ? null : value.slice(0, selectionStart).replace(/,/g, '').length;
32
+ }
33
+
34
+ /** Place the caret after the given count of non-comma characters. */
35
+ export function setCaretSkippingCommas(input: HTMLInputElement, count: number) {
36
+ const {value} = input;
37
+ let idx = 0;
38
+ for (; idx < value.length && count > 0; idx++) {
39
+ if (value[idx] !== ',') count--;
40
+ }
41
+ input.setSelectionRange(idx, idx);
42
+ }
43
+
44
+ /**
45
+ * `beforeinput` listener that steps the caret over an adjacent comma before Backspace or Delete, so
46
+ * the key removes the digit beyond it. Otherwise the reformat would restore the deleted comma.
47
+ * Listens for the native event, which (unlike `keydown`) reports deletes from mobile soft keyboards.
48
+ */
49
+ export function skipCommaOnDelete(ev: InputEvent) {
50
+ const input = ev.target as HTMLInputElement,
51
+ {selectionStart: start, selectionEnd: end, value} = input;
52
+ if (start == null || start !== end) return;
53
+
54
+ if (ev.inputType === 'deleteContentBackward' && value[start - 1] === ',') {
55
+ input.setSelectionRange(start - 1, start - 1);
56
+ } else if (ev.inputType === 'deleteContentForward' && value[start] === ',') {
57
+ input.setSelectionRange(start + 1, start + 1);
58
+ }
59
+ }
@@ -136,9 +136,11 @@ export abstract class HoistModel extends HoistBase implements Loadable {
136
136
 
137
137
  // Internal State
138
138
  // - `_componentProps` is only set for linked models and mirrors the current React props.
139
- // - `_modelLookup` is injected by Hoist when this model is linked into a component hierarchy.
139
+ // - `_linked` is set by Hoist when this model is linked into a component hierarchy.
140
+ // - `_modelLookup` is injected on link, and is null for a model linked at the root.
140
141
  // - `_created` is basic lifecycle metadata (useful for diagnostics/ordering).
141
142
  @observableRef accessor _componentProps: DefaultHoistProps | null = null;
143
+ _linked: boolean = false;
142
144
  _modelLookup: any = null;
143
145
  _created: number = Date.now();
144
146
 
@@ -201,7 +203,7 @@ export abstract class HoistModel extends HoistBase implements Loadable {
201
203
  // Linked model support
202
204
  //---------------------------
203
205
  get isLinked(): boolean {
204
- return !!this._modelLookup;
206
+ return this._linked;
205
207
  }
206
208
 
207
209
  /**
@@ -67,6 +67,7 @@ export function useModelLinker(model: HoistModel, modelLookup: ModelLookup, prop
67
67
 
68
68
  // 1) Linking synchronous work: resolve lookups, initialize props, and call onLinked()
69
69
  if (isLinking) {
70
+ model._linked = true;
70
71
  model._modelLookup = modelLookup;
71
72
  each(model['_xhInjectedParentProperties'], (selector, name) => {
72
73
  const parentModel = modelLookup?.lookupModel(selector);
@@ -22,6 +22,7 @@ export class ManagedRefreshContextModel extends RefreshContextModel {
22
22
 
23
23
  model: ManagedRefreshTarget;
24
24
  refreshPending: boolean = false;
25
+ private pendingIsAutoRefresh: boolean = false;
25
26
 
26
27
  constructor(model: ManagedRefreshTarget) {
27
28
  super();
@@ -42,6 +43,9 @@ export class ManagedRefreshContextModel extends RefreshContextModel {
42
43
  }
43
44
 
44
45
  if (mode === 'onShowLazy') {
46
+ // Replay as an auto-refresh only if every missed refresh was one.
47
+ this.pendingIsAutoRefresh =
48
+ loadSpec.isAutoRefresh && (!this.refreshPending || this.pendingIsAutoRefresh);
45
49
  this.refreshPending = true;
46
50
  }
47
51
  }
@@ -53,7 +57,7 @@ export class ManagedRefreshContextModel extends RefreshContextModel {
53
57
  this.refreshAsync();
54
58
  } else if (mode === 'onShowLazy' && this.refreshPending) {
55
59
  this.refreshPending = false;
56
- this.refreshAsync();
60
+ this.pendingIsAutoRefresh ? this.autoRefreshAsync() : this.refreshAsync();
57
61
  }
58
62
  }
59
63
  }