@xh/hoist 71.0.0-SNAPSHOT.1735587357776 → 71.0.0-SNAPSHOT.1735600578743

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
@@ -4,35 +4,43 @@
4
4
 
5
5
  ### 💥 Breaking Changes
6
6
 
7
- * `ErrorMessage` is now cross-platform. Its import paths has changed from `@xh/hoist/desktop/cmp/error`
8
- and `@xh/hoist/mobile/cmp/error` to `@xh/hoist/cmp/error`.
9
- * `Mask` is now cross-platform. Its import paths has changed from `@xh/hoist/desktop/cmp/mask`
10
- and `@xh/hoist/mobile/cmp/mask` to `@xh/hoist/cmp/mask`.
11
- * `LoadingIndicator` is now cross-platform. Its import paths has changed from
12
- `@xh/hoist/desktop/cmp/loadingindicator` and `@xh/hoist/mobile/cmp/loadingindicator` to
7
+ * Requires `hoist-core >= 26.1` with new APIs to support `ViewManager`.
8
+ * `ErrorMessage` is now cross-platform - update imports from `@xh/hoist/desktop/cmp/error`
9
+ or `@xh/hoist/mobile/cmp/error` to `@xh/hoist/cmp/error`.
10
+ * `Mask` is now cross-platform - update imports from `@xh/hoist/desktop/cmp/mask` or
11
+ `@xh/hoist/mobile/cmp/mask` to `@xh/hoist/cmp/mask`.
12
+ * `LoadingIndicator` is now cross-platform - update imports from
13
+ `@xh/hoist/desktop/cmp/loadingindicator` or `@xh/hoist/mobile/cmp/loadingindicator` to
13
14
  `@xh/hoist/cmp/loadingindicator`.
14
15
  * `TreeMap` and `SplitTreeMap` are now cross-platform and can be used in mobile applications.
15
- Their import paths have changed from `@xh/hoist/desktop/cmp/treemap` to `@xh/hoist/cmp/treemap`.
16
- * The `RefreshButton` `model` prop has been renamed `target` for clarity and consistency.
16
+ Update imports from `@xh/hoist/desktop/cmp/treemap` to `@xh/hoist/cmp/treemap`.
17
+ * Renamed `RefreshButton.model` prop to `target` for clarity and consistency.
17
18
 
18
19
  ### 🎁 New Features
19
20
 
20
- * Major Improvements to ViewManager component
21
- * Support for persisting pending value.
22
- * Handle delete and update collisions more gracefully.
23
- * Support for `settleTime`,
24
- * Improved management UI Dialog.
25
- * Support for "global" views.
26
- * New `SessionStorageService` and associated persistence provider provides support for saving
27
- tab local data across reloads.
28
- * Added support for `AuthZeroClientConfig.audience` to support improved configuration of Auth0 OAuth
29
- clients requesting access tokens, covering cases when third-party cookies are blocked.
21
+ * Major improvements to ViewManager component, including:
22
+ * A clearer, better organized view management dialog.
23
+ * Support for persisting a view's pending value, to avoid users losing changes when e.g. an app
24
+ goes into idle mode and requires a page refresh to restore.
25
+ * Improved handling of delete / update collisions.
26
+ * New `ViewManagerModel.settleTime` config, to allow persisted components such as dashboards to
27
+ fully resolve their rendered state before capturing a baseline for dirty checks.
28
+ * Added `SessionStorageService` and associated persistence provider to support saving tab-local
29
+ data across reloads. Exact analog to `LocalStorageService`, but scoped to lifetime of current tab.
30
+ * Added `AuthZeroClientConfig.audience` config to support improved flow for Auth0 OAuth clients that
31
+ request access tokens. Specify your access token audience here to allow the client to fetch both
32
+ ID and access tokens in a single request and to use refresh tokens to maintain access without
33
+ relying on third-party cookies.
34
+ * Updated sorting on grouped grids to place ungrouped items at the bottom.
30
35
 
31
36
  ### 🐞 Bug Fixes
32
37
 
33
38
  * Fixed sizing and position of mobile `TabContainer` switcher, particularly when the switcher is
34
39
  positioned with `top` orientation.
35
40
  * Fixed styling of `ButtonGroup` in vertical orientations.
41
+ * Improved handling of calls to `DashContainerModel.loadStateAsync()` when the component has yet
42
+ to be rendered. Requested state updates are no longer dropped, and will be applied as soon as the
43
+ component is ready to do so.
36
44
 
37
45
  ### ⚙️ Technical
38
46
 
@@ -46,6 +54,10 @@
46
54
  provided by FontAwesome.
47
55
  * Improved accuracy of `PersistOptions.type` enum.
48
56
 
57
+ ### 📚 Libraries
58
+
59
+ * react-grid-layout `1.4.3 → 1.5.0`
60
+
49
61
  ## v70.0.0 - 2024-11-15
50
62
 
51
63
  ### 💥 Breaking Changes (upgrade difficulty: 🟢 LOW - changes to advanced persistence APIs)
@@ -3,17 +3,23 @@ import { Persistable, PersistableState } from '@xh/hoist/core';
3
3
  import { DashCanvasViewModel, DashCanvasViewSpec, DashConfig, DashViewState, DashModel } from '../';
4
4
  import '@xh/hoist/desktop/register';
5
5
  export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCanvasItemState> {
6
- /** Total number of columns (x coordinates for views correspond with column numbers). */
6
+ /**
7
+ * Total number of columns (x coordinates for views correspond with column numbers).
8
+ * Default `12`.
9
+ */
7
10
  columns?: number;
8
- /** Height of each row in pixels (y coordinates for views correspond with row numbers). */
11
+ /**
12
+ * Height of each row in pixels (y coordinates for views correspond with row numbers).
13
+ * Default `50`.
14
+ */
9
15
  rowHeight?: number;
10
- /** Whether views should "compact" vertically to condense vertical space. */
16
+ /** Whether views should "compact" vertically to condense vertical space. Default `true`. */
11
17
  compact?: boolean;
12
- /** Between items [x,y] in pixels. */
18
+ /** Between items [x,y] in pixels. Default `[10, 10]`. */
13
19
  margin?: [number, number];
14
- /** Maximum number of rows permitted for this container. */
20
+ /** Maximum number of rows permitted for this container. Default `Infinity`. */
15
21
  maxRows?: number;
16
- /** Padding inside the container [x, y] in pixels. */
22
+ /** Padding inside the container [x, y] in pixels. Defaults to same as `margin`. */
17
23
  containerPadding?: [number, number];
18
24
  }
19
25
  export interface DashCanvasItemState {
@@ -47,7 +53,6 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
47
53
  layout: any[];
48
54
  ref: import("react").RefObject<HTMLElement> & import("react").RefCallback<HTMLElement>;
49
55
  isResizing: boolean;
50
- private scrollbarVisible;
51
56
  private isLoadingState;
52
57
  get rglLayout(): any[];
53
58
  constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems }: DashCanvasConfig);
@@ -96,7 +101,6 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
96
101
  }>): void;
97
102
  private getLayoutFromPosition;
98
103
  private addViewInternal;
99
- onVisibleChange(visible: boolean): void;
100
104
  onRglLayoutChange(rglLayout: any): void;
101
105
  private setLayout;
102
106
  private loadState;
@@ -110,5 +114,4 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
110
114
  private hasSpec;
111
115
  private getViewsBySpecId;
112
116
  private getNextAvailablePosition;
113
- private fireWindowResizeEvent;
114
117
  }
@@ -19,7 +19,6 @@ import {dashCanvasAddViewButton} from '@xh/hoist/desktop/cmp/button/DashCanvasAd
19
19
  import '@xh/hoist/desktop/register';
20
20
  import {Classes, overlay} from '@xh/hoist/kit/blueprint';
21
21
  import {TEST_ID} from '@xh/hoist/utils/js';
22
- import {useOnVisibleChange} from '@xh/hoist/utils/react';
23
22
  import classNames from 'classnames';
24
23
  import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
25
24
  import {DashCanvasModel} from './DashCanvasModel';
@@ -49,13 +48,8 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
49
48
 
50
49
  render({className, model, testId}, ref) {
51
50
  const isDraggable = !model.layoutLocked,
52
- isResizable = !model.layoutLocked;
53
-
54
- ref = composeRefs(
55
- ref,
56
- model.ref,
57
- useOnVisibleChange(viz => model.onVisibleChange(viz))
58
- );
51
+ isResizable = !model.layoutLocked,
52
+ [padX, padY] = model.containerPadding;
59
53
 
60
54
  return refreshContextView({
61
55
  model: model.refreshContextModel,
@@ -65,7 +59,8 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
65
59
  isDraggable ? `${className}--draggable` : null,
66
60
  isResizable ? `${className}--resizable` : null
67
61
  ),
68
- ref,
62
+ style: {padding: `${padY}px ${padX}px`},
63
+ ref: composeRefs(ref, model.ref),
69
64
  onContextMenu: e => onContextMenu(e, model),
70
65
  items: [
71
66
  reactGridLayout({
@@ -77,7 +72,7 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
77
72
  compactType: model.compact ? 'vertical' : null,
78
73
  margin: model.margin,
79
74
  maxRows: model.maxRows,
80
- containerPadding: model.containerPadding,
75
+ containerPadding: [0, 0], // Workaround for https://github.com/react-grid-layout/react-grid-layout/issues/1990
81
76
  autoSize: true,
82
77
  isBounded: true,
83
78
  draggableHandle:
@@ -27,22 +27,28 @@ import {
27
27
  } from 'lodash';
28
28
 
29
29
  export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCanvasItemState> {
30
- /** Total number of columns (x coordinates for views correspond with column numbers). */
30
+ /**
31
+ * Total number of columns (x coordinates for views correspond with column numbers).
32
+ * Default `12`.
33
+ */
31
34
  columns?: number;
32
35
 
33
- /** Height of each row in pixels (y coordinates for views correspond with row numbers). */
36
+ /**
37
+ * Height of each row in pixels (y coordinates for views correspond with row numbers).
38
+ * Default `50`.
39
+ */
34
40
  rowHeight?: number;
35
41
 
36
- /** Whether views should "compact" vertically to condense vertical space. */
42
+ /** Whether views should "compact" vertically to condense vertical space. Default `true`. */
37
43
  compact?: boolean;
38
44
 
39
- /** Between items [x,y] in pixels. */
45
+ /** Between items [x,y] in pixels. Default `[10, 10]`. */
40
46
  margin?: [number, number];
41
47
 
42
- /** Maximum number of rows permitted for this container. */
48
+ /** Maximum number of rows permitted for this container. Default `Infinity`. */
43
49
  maxRows?: number;
44
50
 
45
- /** Padding inside the container [x, y] in pixels. */
51
+ /** Padding inside the container [x, y] in pixels. Defaults to same as `margin`. */
46
52
  containerPadding?: [number, number];
47
53
  }
48
54
 
@@ -97,7 +103,6 @@ export class DashCanvasModel
97
103
  @observable.ref layout: any[] = [];
98
104
  ref = createObservableRef<HTMLElement>();
99
105
  isResizing: boolean;
100
- private scrollbarVisible: boolean;
101
106
  private isLoadingState: boolean;
102
107
 
103
108
  get rglLayout() {
@@ -131,7 +136,7 @@ export class DashCanvasModel
131
136
  compact = true,
132
137
  margin = [10, 10],
133
138
  maxRows = Infinity,
134
- containerPadding = null,
139
+ containerPadding = margin,
135
140
  extraMenuItems
136
141
  }: DashCanvasConfig) {
137
142
  super();
@@ -194,19 +199,10 @@ export class DashCanvasModel
194
199
  });
195
200
  }
196
201
 
197
- this.addReaction(
198
- {
199
- track: () => this.viewState,
200
- run: () => (this.state = this.buildState())
201
- },
202
- {
203
- when: () => !!this.ref.current,
204
- run: () => {
205
- const {current: node} = this.ref;
206
- this.scrollbarVisible = node.offsetWidth > node.clientWidth;
207
- }
208
- }
209
- );
202
+ this.addReaction({
203
+ track: () => this.viewState,
204
+ run: () => (this.state = this.buildState())
205
+ });
210
206
  }
211
207
 
212
208
  /** Removes all views from the canvas */
@@ -385,12 +381,6 @@ export class DashCanvasModel
385
381
  return model;
386
382
  }
387
383
 
388
- // Trigger window resize event when component becomes visible to ensure layout adjusted to
389
- // current window size - fixes https://github.com/xh/hoist-react/issues/3215
390
- onVisibleChange(visible: boolean) {
391
- if (visible) this.fireWindowResizeEvent();
392
- }
393
-
394
384
  onRglLayoutChange(rglLayout) {
395
385
  rglLayout = rglLayout.map(it => pick(it, ['i', 'x', 'y', 'w', 'h']));
396
386
  this.setLayout(rglLayout);
@@ -404,15 +394,6 @@ export class DashCanvasModel
404
394
 
405
395
  this.layout = layout;
406
396
  if (!this.isLoadingState) this.state = this.buildState();
407
-
408
- // Check if scrollbar visibility has changed, and force resize event if so
409
- const node = this.ref.current;
410
- if (!node) return;
411
- const scrollbarVisible = node.offsetWidth > node.clientWidth;
412
- if (scrollbarVisible !== this.scrollbarVisible) {
413
- this.fireWindowResizeEvent();
414
- this.scrollbarVisible = scrollbarVisible;
415
- }
416
397
  }
417
398
 
418
399
  @action
@@ -530,8 +511,4 @@ export class DashCanvasModel
530
511
 
531
512
  return {x: defaultX, y: endY ?? rows};
532
513
  }
533
-
534
- private fireWindowResizeEvent() {
535
- window.dispatchEvent(new Event('resize'));
536
- }
537
514
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "71.0.0-SNAPSHOT.1735587357776",
3
+ "version": "71.0.0-SNAPSHOT.1735600578743",
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",
@@ -69,7 +69,7 @@
69
69
  "react-beautiful-dnd": "~13.1.0",
70
70
  "react-dates": "~21.8.0",
71
71
  "react-dropzone": "~10.2.2",
72
- "react-grid-layout": "1.4.3",
72
+ "react-grid-layout": "1.5.0",
73
73
  "react-markdown": "~9.0.1",
74
74
  "react-onsenui": "~1.13.2",
75
75
  "react-popper": "~2.3.0",