@xh/hoist 79.0.0-SNAPSHOT.1766500045639 → 79.0.0-SNAPSHOT.1766589539491

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
@@ -10,6 +10,10 @@
10
10
  persist "favorited" tab state across sessions. Additionally, existing static `TabSwitcher` now
11
11
  supports context-menu items. See `TabContainerConfig.switcher`.
12
12
  * Changed the icon used for the Grid autosize buttons and menu option (to 🪄).
13
+ * DashCanvas new features:
14
+ * supports showing a grid background.
15
+ * supports 2 compacting strategies: 'vertical' or 'horizontal'
16
+
13
17
 
14
18
  ### 💥 Breaking Changes
15
19
 
@@ -27,6 +31,11 @@
27
31
  * Tightened the typing of `LocalDate` adjustment methods with new `LocalDateUnit` type. Some less
28
32
  common or ambiguous units (e.g. `date` or `d`) are no longer supported. Also typed the adjustment
29
33
  `value` args to `number` where applicable.
34
+ * Your app must update `compilerOptions.moduleResolution` to "bundler" in `tsconfig.json`
35
+ * If using the `DashCanvas` `rglOptions` prop, you might have to update it to reflect changes in
36
+ `react-grid-layout` v2+ (not common).
37
+ * `DashCanvasModel.containerPadding` is now applied to the `react-grid-layout` div by RGL, not to the
38
+ hoist-react provided containing div. This may affect printing layouts.
30
39
 
31
40
  ### 🐞 Bug Fixes
32
41
 
@@ -44,7 +53,11 @@
44
53
  * `RelativeTimestampProps.options` - provide directly as top-level props
45
54
 
46
55
  * Improved the efficiency and logging of MsalClient.
47
- *
56
+
57
+ ### 📚 Libraries
58
+
59
+ * react-grid-layout `1.5.0 → 2.1.1`
60
+
48
61
  ## 78.1.4 - 2025-12-05
49
62
 
50
63
  ### 🐞 Bug Fixes
@@ -53,7 +53,7 @@ export declare class GridLocalModel extends HoistModel {
53
53
  onLinked(): void;
54
54
  private createDefaultAgOptions;
55
55
  getColumnDefs(): Array<ColDef | ColGroupDef>;
56
- getContextMenuItems: (params: GetContextMenuItemsParams) => (string | import("@xh/hoist/kit/ag-grid").MenuItemDef<any, any>)[];
56
+ getContextMenuItems: (params: GetContextMenuItemsParams) => (string | import("ag-grid-community").MenuItemDef<any, any>)[];
57
57
  dataReaction(): {
58
58
  track: () => (boolean | RecordSet | import("../../data").StoreRecord[] | import("@xh/hoist/core").VSide)[];
59
59
  run: () => void;
@@ -123,7 +123,7 @@ export declare class GridLocalModel extends HoistModel {
123
123
  readFilterState(): import("ag-grid-community").FilterModel;
124
124
  writeFilterState(filterState: any): void;
125
125
  processCellForClipboard: ({ value, node, column }: ProcessCellForExportParams) => any;
126
- navigateToNextCell: (agParams: any) => import("@xh/hoist/kit/ag-grid").CellPosition;
126
+ navigateToNextCell: (agParams: any) => import("ag-grid-community").CellPosition;
127
127
  onCellMouseDown: (evt: any) => void;
128
128
  onKeyDown: (evt: any) => void;
129
129
  onRowClicked: (evt: any) => void;
@@ -413,7 +413,7 @@ export declare class GridModel extends HoistModel {
413
413
  /** True if this grid has no records to show in its store. */
414
414
  get empty(): boolean;
415
415
  get isReady(): boolean;
416
- get agApi(): import("@xh/hoist/kit/ag-grid").GridApi<any>;
416
+ get agApi(): import("ag-grid-community").GridApi<any>;
417
417
  get sizingMode(): SizingMode;
418
418
  set sizingMode(v: SizingMode);
419
419
  setSizingMode(v: SizingMode): void;
@@ -1,6 +1,6 @@
1
1
  import { TEST_ID } from '@xh/hoist/utils/js';
2
2
  import { ComponentType, JSX, Key, ReactElement, ReactNode } from 'react';
3
- import { PlainObject, Some, Thunkable } from './types/Types';
3
+ import { PlainObject, Thunkable } from './types/Types';
4
4
  /**
5
5
  * Alternative format for specifying React Elements in render functions. This type is designed to
6
6
  * provide a well-formatted, declarative, native javascript approach to configuring Elements and
@@ -26,9 +26,9 @@ import { PlainObject, Some, Thunkable } from './types/Types';
26
26
  */
27
27
  export type ElementSpec<P> = Omit<P, 'items' | 'item' | 'omit'> & {
28
28
  /** Child Element(s). Equivalent provided as Rest Arguments to React.createElement.*/
29
- items?: Some<ReactNode>;
29
+ items?: ReactNode;
30
30
  /** Equivalent to `items`, offered for code clarity when only one child is needed. */
31
- item?: Some<ReactNode>;
31
+ item?: ReactNode;
32
32
  /** True to exclude the Element. */
33
33
  omit?: Thunkable<boolean>;
34
34
  /** React key for this component. */
@@ -1,6 +1,6 @@
1
+ import { type GridLayoutProps } from 'react-grid-layout';
1
2
  import { HoistProps, TestSupportProps } from '@xh/hoist/core';
2
3
  import '@xh/hoist/desktop/register';
3
- import type { ReactGridLayoutProps } from 'react-grid-layout';
4
4
  import { DashCanvasModel } from './DashCanvasModel';
5
5
  import 'react-grid-layout/css/styles.css';
6
6
  import './DashCanvas.scss';
@@ -8,10 +8,10 @@ export interface DashCanvasProps extends HoistProps<DashCanvasModel>, TestSuppor
8
8
  /**
9
9
  * Optional additional configuration options to pass through to the underlying ReactGridLayout component.
10
10
  * See the RGL documentation for details:
11
- * {@link https://www.npmjs.com/package/react-grid-layout#grid-layout-props}
11
+ * {@link https://www.npmjs.com/package/react-grid-layout#api-reference}
12
12
  * Note that some ReactGridLayout props are managed directly by DashCanvas and will be overridden if provided here.
13
13
  */
14
- rglOptions?: ReactGridLayoutProps;
14
+ rglOptions?: Partial<GridLayoutProps>;
15
15
  }
16
16
  /**
17
17
  * Dashboard-style container that allows users to drag-and-drop child widgets into flexible layouts.
@@ -1,3 +1,4 @@
1
+ import type { LayoutItem } from 'react-grid-layout';
1
2
  import { Persistable, PersistableState } from '@xh/hoist/core';
2
3
  import { DashCanvasViewModel, DashCanvasViewSpec, DashConfig, DashViewState, DashModel } from '../';
3
4
  import '@xh/hoist/desktop/register';
@@ -12,14 +13,22 @@ export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCan
12
13
  * Default `50`.
13
14
  */
14
15
  rowHeight?: number;
15
- /** Whether views should "compact" vertically to condense vertical space. Default `true`. */
16
- compact?: boolean;
16
+ /**
17
+ * Whether views should "compact" vertically or horizontally
18
+ * to condense space. Default `true` defaults to vertical compaction.
19
+ * See react-grid-layout docs for more information.
20
+ * */
21
+ compact?: boolean | 'vertical' | 'horizontal';
17
22
  /** Between items [x,y] in pixels. Default `[10, 10]`. */
18
23
  margin?: [number, number];
19
- /** Maximum number of rows permitted for this container. Default `Infinity`. */
20
- maxRows?: number;
21
24
  /** Padding inside the container [x, y] in pixels. Defaults to same as `margin`. */
22
25
  containerPadding?: [number, number];
26
+ /** Maximum number of rows permitted for this container. Default `Infinity`. */
27
+ maxRows?: number;
28
+ /**
29
+ * Whether a grid background should be shown. Default false.
30
+ */
31
+ showGridBackground?: boolean;
23
32
  }
24
33
  export interface DashCanvasItemState {
25
34
  layout: DashCanvasItemLayout;
@@ -42,9 +51,11 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
42
51
  }> {
43
52
  columns: number;
44
53
  rowHeight: number;
45
- compact: boolean;
54
+ compact: 'vertical' | 'horizontal';
46
55
  margin: [number, number];
47
56
  containerPadding: [number, number];
57
+ showGridBackground: boolean;
58
+ rglHeight: number;
48
59
  maxRows: number;
49
60
  /** Current number of rows in canvas */
50
61
  get rows(): number;
@@ -54,7 +65,7 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
54
65
  isResizing: boolean;
55
66
  private isLoadingState;
56
67
  get rglLayout(): any[];
57
- constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems }: DashCanvasConfig);
68
+ constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems, showGridBackground }: DashCanvasConfig);
58
69
  /** Removes all views from the canvas */
59
70
  clear(): void;
60
71
  /**
@@ -98,9 +109,10 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
98
109
  setPersistableState(persistableState: PersistableState<{
99
110
  state: DashCanvasItemState[];
100
111
  }>): void;
112
+ private rglResizeObserver;
101
113
  private getLayoutFromPosition;
102
114
  private addViewInternal;
103
- onRglLayoutChange(rglLayout: any): void;
115
+ onRglLayoutChange(rglLayout: LayoutItem[]): void;
104
116
  private setLayout;
105
117
  private loadState;
106
118
  private buildState;
@@ -42,12 +42,12 @@ export interface PanelProps extends HoistProps<PanelModel>, Omit<BoxProps, 'titl
42
42
  * A toolbar to be docked at the top of the panel.
43
43
  * If specified as an array, items will be passed as children to a Toolbar component.
44
44
  */
45
- tbar?: Some<ReactNode>;
45
+ tbar?: ReactNode;
46
46
  /**
47
47
  * A toolbar to be docked at the bottom of the panel.
48
48
  * If specified as an array, items will be passed as children to a Toolbar component.
49
49
  */
50
- bbar?: Some<ReactNode>;
50
+ bbar?: ReactNode;
51
51
  /** Title text added to the panel's header. */
52
52
  title?: ReactNode;
53
53
  /** Title to be used when the panel is collapsed. Defaults to `title`. */
@@ -1,4 +1,4 @@
1
- import { HoistProps, PlainObject, Some } from '@xh/hoist/core';
1
+ import { HoistProps, PlainObject } from '@xh/hoist/core';
2
2
  import { PanelProps } from '@xh/hoist/desktop/cmp/panel';
3
3
  import '@xh/hoist/desktop/register';
4
4
  import { ReactElement, ReactNode } from 'react';
@@ -14,7 +14,7 @@ export interface RestGridProps extends HoistProps<RestGridModel>, Omit<PanelProp
14
14
  * Optional components rendered adjacent to the top toolbar's action buttons.
15
15
  * See also {@link tbar} to take full control of the toolbar.
16
16
  */
17
- extraToolbarItems?: Some<ReactNode> | (() => Some<ReactNode>);
17
+ extraToolbarItems?: ReactNode | (() => ReactNode);
18
18
  /** Classname to be passed to RestForm. */
19
19
  formClassName?: string;
20
20
  /**
@@ -28,6 +28,6 @@ export interface RestGridProps extends HoistProps<RestGridModel>, Omit<PanelProp
28
28
  * configs `toolbarActions`, `filterFields`, and `showRefreshButton`. If specified as an array,
29
29
  * will be passed as children to a Toolbar component.
30
30
  */
31
- tbar?: Some<ReactNode>;
31
+ tbar?: ReactNode;
32
32
  }
33
33
  export declare const RestGrid: import("react").FC<RestGridProps>, restGrid: import("@xh/hoist/core").ElementFactory<RestGridProps>;
@@ -1,3 +1,4 @@
1
- import ReactMarkdown from 'react-markdown';
1
+ import { type ElementFactory } from '@xh/hoist/core';
2
+ import ReactMarkdown, { type Options } from 'react-markdown';
2
3
  export { ReactMarkdown };
3
- export declare const reactMarkdown: import("@xh/hoist/core").ElementFactory<Readonly<import("react-markdown/lib").Options>>;
4
+ export declare const reactMarkdown: ElementFactory<Readonly<Options>>;
@@ -5,93 +5,93 @@ export { Swiper, SwiperSlide, EffectCreative };
5
5
  export declare const swiper: import("@xh/hoist/core").ElementFactory<import("react").RefAttributes<import("swiper/react").SwiperRef> & Omit<import("react").HTMLAttributes<HTMLElement>, "onKeyPress" | "onProgress" | "onClick" | "onDoubleClick" | "onTouchEnd" | "onTouchMove" | "onTouchStart" | "onScroll" | "onTransitionEnd" | "onResize"> & import("swiper/types").SwiperOptions & {
6
6
  tag?: string;
7
7
  wrapperTag?: string;
8
- onSwiper?: (swiper: import("swiper/react").SwiperClass) => void;
9
- onAutoplayStart?: (swiper: import("swiper/react").SwiperClass) => void;
10
- onAutoplayStop?: (swiper: import("swiper/react").SwiperClass) => void;
11
- onAutoplayPause?: (swiper: import("swiper/react").SwiperClass) => void;
12
- onAutoplayResume?: (swiper: import("swiper/react").SwiperClass) => void;
13
- onAutoplayTimeLeft?: (swiper: import("swiper/react").SwiperClass, timeLeft: number, percentage: number) => void;
14
- onAutoplay?: (swiper: import("swiper/react").SwiperClass) => void;
15
- onHashChange?: (swiper: import("swiper/react").SwiperClass) => void;
16
- onHashSet?: (swiper: import("swiper/react").SwiperClass) => void;
17
- onKeyPress?: (swiper: import("swiper/react").SwiperClass, keyCode: string) => void;
18
- onNavigationHide?: (swiper: import("swiper/react").SwiperClass) => void;
19
- onNavigationShow?: (swiper: import("swiper/react").SwiperClass) => void;
20
- onNavigationPrev?: (swiper: import("swiper/react").SwiperClass) => void;
21
- onNavigationNext?: (swiper: import("swiper/react").SwiperClass) => void;
22
- onScroll?: (swiper: import("swiper/react").SwiperClass, event: WheelEvent) => void;
23
- onScrollbarDragStart?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
24
- onScrollbarDragMove?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
25
- onScrollbarDragEnd?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
26
- onPaginationRender?: (swiper: import("swiper/react").SwiperClass, paginationEl: HTMLElement) => void;
27
- onPaginationUpdate?: (swiper: import("swiper/react").SwiperClass, paginationEl: HTMLElement) => void;
28
- onPaginationHide?: (swiper: import("swiper/react").SwiperClass) => void;
29
- onPaginationShow?: (swiper: import("swiper/react").SwiperClass) => void;
30
- onZoomChange?: (swiper: import("swiper/react").SwiperClass, scale: number, imageEl: HTMLElement, slideEl: HTMLElement) => void;
31
- onInit?: (swiper: import("swiper/react").SwiperClass) => any;
32
- onBeforeDestroy?: (swiper: import("swiper/react").SwiperClass) => void;
33
- onSlidesUpdated?: (swiper: import("swiper/react").SwiperClass) => void;
34
- onSlideChange?: (swiper: import("swiper/react").SwiperClass) => void;
35
- onSlideChangeTransitionStart?: (swiper: import("swiper/react").SwiperClass) => void;
36
- onSlideChangeTransitionEnd?: (swiper: import("swiper/react").SwiperClass) => void;
37
- onSlideNextTransitionStart?: (swiper: import("swiper/react").SwiperClass) => void;
38
- onSlideNextTransitionEnd?: (swiper: import("swiper/react").SwiperClass) => void;
39
- onSlidePrevTransitionStart?: (swiper: import("swiper/react").SwiperClass) => void;
40
- onSlidePrevTransitionEnd?: (swiper: import("swiper/react").SwiperClass) => void;
41
- onTransitionStart?: (swiper: import("swiper/react").SwiperClass) => void;
42
- onTransitionEnd?: (swiper: import("swiper/react").SwiperClass) => void;
43
- onTouchStart?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
44
- onTouchMove?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
45
- onTouchMoveOpposite?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
46
- onSliderMove?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
47
- onTouchEnd?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
48
- onClick?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
49
- onTap?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
50
- onDoubleTap?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
51
- onProgress?: (swiper: import("swiper/react").SwiperClass, progress: number) => void;
52
- onReachBeginning?: (swiper: import("swiper/react").SwiperClass) => void;
53
- onReachEnd?: (swiper: import("swiper/react").SwiperClass) => void;
54
- onToEdge?: (swiper: import("swiper/react").SwiperClass) => void;
55
- onFromEdge?: (swiper: import("swiper/react").SwiperClass) => void;
56
- onSetTranslate?: (swiper: import("swiper/react").SwiperClass, translate: number) => void;
57
- onSetTransition?: (swiper: import("swiper/react").SwiperClass, transition: number) => void;
58
- onResize?: (swiper: import("swiper/react").SwiperClass) => void;
59
- onObserverUpdate?: (swiper: import("swiper/react").SwiperClass) => void;
60
- onBeforeLoopFix?: (swiper: import("swiper/react").SwiperClass) => void;
61
- onLoopFix?: (swiper: import("swiper/react").SwiperClass) => void;
62
- onBreakpoint?: (swiper: import("swiper/react").SwiperClass, breakpointParams: import("swiper/types").SwiperOptions) => void;
63
- _beforeBreakpoint?: (swiper: import("swiper/react").SwiperClass, breakpointParams: import("swiper/types").SwiperOptions) => void;
64
- _containerClasses?: (swiper: import("swiper/react").SwiperClass, classNames: string) => void;
65
- _slideClass?: (swiper: import("swiper/react").SwiperClass, slideEl: HTMLElement, classNames: string) => void;
66
- _slideClasses?: (swiper: import("swiper/react").SwiperClass, slides: {
8
+ onSwiper?: (swiper: import("swiper/types").Swiper) => void;
9
+ onAutoplayStart?: (swiper: import("swiper/types").Swiper) => void;
10
+ onAutoplayStop?: (swiper: import("swiper/types").Swiper) => void;
11
+ onAutoplayPause?: (swiper: import("swiper/types").Swiper) => void;
12
+ onAutoplayResume?: (swiper: import("swiper/types").Swiper) => void;
13
+ onAutoplayTimeLeft?: (swiper: import("swiper/types").Swiper, timeLeft: number, percentage: number) => void;
14
+ onAutoplay?: (swiper: import("swiper/types").Swiper) => void;
15
+ onHashChange?: (swiper: import("swiper/types").Swiper) => void;
16
+ onHashSet?: (swiper: import("swiper/types").Swiper) => void;
17
+ onKeyPress?: (swiper: import("swiper/types").Swiper, keyCode: string) => void;
18
+ onNavigationHide?: (swiper: import("swiper/types").Swiper) => void;
19
+ onNavigationShow?: (swiper: import("swiper/types").Swiper) => void;
20
+ onNavigationPrev?: (swiper: import("swiper/types").Swiper) => void;
21
+ onNavigationNext?: (swiper: import("swiper/types").Swiper) => void;
22
+ onScroll?: (swiper: import("swiper/types").Swiper, event: WheelEvent) => void;
23
+ onScrollbarDragStart?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
24
+ onScrollbarDragMove?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
25
+ onScrollbarDragEnd?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
26
+ onPaginationRender?: (swiper: import("swiper/types").Swiper, paginationEl: HTMLElement) => void;
27
+ onPaginationUpdate?: (swiper: import("swiper/types").Swiper, paginationEl: HTMLElement) => void;
28
+ onPaginationHide?: (swiper: import("swiper/types").Swiper) => void;
29
+ onPaginationShow?: (swiper: import("swiper/types").Swiper) => void;
30
+ onZoomChange?: (swiper: import("swiper/types").Swiper, scale: number, imageEl: HTMLElement, slideEl: HTMLElement) => void;
31
+ onInit?: (swiper: import("swiper/types").Swiper) => any;
32
+ onBeforeDestroy?: (swiper: import("swiper/types").Swiper) => void;
33
+ onSlidesUpdated?: (swiper: import("swiper/types").Swiper) => void;
34
+ onSlideChange?: (swiper: import("swiper/types").Swiper) => void;
35
+ onSlideChangeTransitionStart?: (swiper: import("swiper/types").Swiper) => void;
36
+ onSlideChangeTransitionEnd?: (swiper: import("swiper/types").Swiper) => void;
37
+ onSlideNextTransitionStart?: (swiper: import("swiper/types").Swiper) => void;
38
+ onSlideNextTransitionEnd?: (swiper: import("swiper/types").Swiper) => void;
39
+ onSlidePrevTransitionStart?: (swiper: import("swiper/types").Swiper) => void;
40
+ onSlidePrevTransitionEnd?: (swiper: import("swiper/types").Swiper) => void;
41
+ onTransitionStart?: (swiper: import("swiper/types").Swiper) => void;
42
+ onTransitionEnd?: (swiper: import("swiper/types").Swiper) => void;
43
+ onTouchStart?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
44
+ onTouchMove?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
45
+ onTouchMoveOpposite?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
46
+ onSliderMove?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
47
+ onTouchEnd?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
48
+ onClick?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
49
+ onTap?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
50
+ onDoubleTap?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
51
+ onProgress?: (swiper: import("swiper/types").Swiper, progress: number) => void;
52
+ onReachBeginning?: (swiper: import("swiper/types").Swiper) => void;
53
+ onReachEnd?: (swiper: import("swiper/types").Swiper) => void;
54
+ onToEdge?: (swiper: import("swiper/types").Swiper) => void;
55
+ onFromEdge?: (swiper: import("swiper/types").Swiper) => void;
56
+ onSetTranslate?: (swiper: import("swiper/types").Swiper, translate: number) => void;
57
+ onSetTransition?: (swiper: import("swiper/types").Swiper, transition: number) => void;
58
+ onResize?: (swiper: import("swiper/types").Swiper) => void;
59
+ onObserverUpdate?: (swiper: import("swiper/types").Swiper) => void;
60
+ onBeforeLoopFix?: (swiper: import("swiper/types").Swiper) => void;
61
+ onLoopFix?: (swiper: import("swiper/types").Swiper) => void;
62
+ onBreakpoint?: (swiper: import("swiper/types").Swiper, breakpointParams: import("swiper/types").SwiperOptions) => void;
63
+ _beforeBreakpoint?: (swiper: import("swiper/types").Swiper, breakpointParams: import("swiper/types").SwiperOptions) => void;
64
+ _containerClasses?: (swiper: import("swiper/types").Swiper, classNames: string) => void;
65
+ _slideClass?: (swiper: import("swiper/types").Swiper, slideEl: HTMLElement, classNames: string) => void;
66
+ _slideClasses?: (swiper: import("swiper/types").Swiper, slides: {
67
67
  slideEl: HTMLElement;
68
68
  classNames: string;
69
69
  index: number;
70
70
  }[]) => void;
71
- _swiper?: (swiper: import("swiper/react").SwiperClass) => void;
72
- _freeModeNoMomentumRelease?: (swiper: import("swiper/react").SwiperClass) => void;
73
- onActiveIndexChange?: (swiper: import("swiper/react").SwiperClass) => void;
74
- onSnapIndexChange?: (swiper: import("swiper/react").SwiperClass) => void;
75
- onRealIndexChange?: (swiper: import("swiper/react").SwiperClass) => void;
76
- onAfterInit?: (swiper: import("swiper/react").SwiperClass) => void;
77
- onBeforeInit?: (swiper: import("swiper/react").SwiperClass) => void;
78
- onBeforeResize?: (swiper: import("swiper/react").SwiperClass) => void;
79
- onBeforeSlideChangeStart?: (swiper: import("swiper/react").SwiperClass) => void;
80
- onBeforeTransitionStart?: (swiper: import("swiper/react").SwiperClass, speed: number, internal: any) => void;
81
- onChangeDirection?: (swiper: import("swiper/react").SwiperClass) => void;
82
- onDoubleClick?: (swiper: import("swiper/react").SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => void;
83
- onDestroy?: (swiper: import("swiper/react").SwiperClass) => void;
84
- onMomentumBounce?: (swiper: import("swiper/react").SwiperClass) => void;
85
- onOrientationchange?: (swiper: import("swiper/react").SwiperClass) => void;
86
- onSlideResetTransitionStart?: (swiper: import("swiper/react").SwiperClass) => void;
87
- onSlideResetTransitionEnd?: (swiper: import("swiper/react").SwiperClass) => void;
88
- onSliderFirstMove?: (swiper: import("swiper/react").SwiperClass, event: TouchEvent) => void;
89
- onSlidesLengthChange?: (swiper: import("swiper/react").SwiperClass) => void;
90
- onSlidesGridLengthChange?: (swiper: import("swiper/react").SwiperClass) => void;
91
- onSnapGridLengthChange?: (swiper: import("swiper/react").SwiperClass) => void;
92
- onUpdate?: (swiper: import("swiper/react").SwiperClass) => void;
93
- onLock?: (swiper: import("swiper/react").SwiperClass) => void;
94
- onUnlock?: (swiper: import("swiper/react").SwiperClass) => void;
71
+ _swiper?: (swiper: import("swiper/types").Swiper) => void;
72
+ _freeModeNoMomentumRelease?: (swiper: import("swiper/types").Swiper) => void;
73
+ onActiveIndexChange?: (swiper: import("swiper/types").Swiper) => void;
74
+ onSnapIndexChange?: (swiper: import("swiper/types").Swiper) => void;
75
+ onRealIndexChange?: (swiper: import("swiper/types").Swiper) => void;
76
+ onAfterInit?: (swiper: import("swiper/types").Swiper) => void;
77
+ onBeforeInit?: (swiper: import("swiper/types").Swiper) => void;
78
+ onBeforeResize?: (swiper: import("swiper/types").Swiper) => void;
79
+ onBeforeSlideChangeStart?: (swiper: import("swiper/types").Swiper) => void;
80
+ onBeforeTransitionStart?: (swiper: import("swiper/types").Swiper, speed: number, internal: any) => void;
81
+ onChangeDirection?: (swiper: import("swiper/types").Swiper) => void;
82
+ onDoubleClick?: (swiper: import("swiper/types").Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
83
+ onDestroy?: (swiper: import("swiper/types").Swiper) => void;
84
+ onMomentumBounce?: (swiper: import("swiper/types").Swiper) => void;
85
+ onOrientationchange?: (swiper: import("swiper/types").Swiper) => void;
86
+ onSlideResetTransitionStart?: (swiper: import("swiper/types").Swiper) => void;
87
+ onSlideResetTransitionEnd?: (swiper: import("swiper/types").Swiper) => void;
88
+ onSliderFirstMove?: (swiper: import("swiper/types").Swiper, event: TouchEvent) => void;
89
+ onSlidesLengthChange?: (swiper: import("swiper/types").Swiper) => void;
90
+ onSlidesGridLengthChange?: (swiper: import("swiper/types").Swiper) => void;
91
+ onSnapGridLengthChange?: (swiper: import("swiper/types").Swiper) => void;
92
+ onUpdate?: (swiper: import("swiper/types").Swiper) => void;
93
+ onLock?: (swiper: import("swiper/types").Swiper) => void;
94
+ onUnlock?: (swiper: import("swiper/types").Swiper) => void;
95
95
  } & {
96
96
  children?: import("react").ReactNode | undefined;
97
97
  }>, swiperSlide: import("@xh/hoist/core").ElementFactory<import("swiper/react").SwiperSlideProps>;
@@ -4,7 +4,7 @@ import { ReactNode, ReactElement } from 'react';
4
4
  import './Panel.scss';
5
5
  export interface PanelProps extends HoistProps, Omit<BoxProps, 'title'> {
6
6
  /** A toolbar to be docked at the bottom of the panel. */
7
- bbar?: Some<ReactNode>;
7
+ bbar?: ReactNode;
8
8
  /** CSS class name specific to the panel's header. */
9
9
  headerClassName?: string;
10
10
  /** Items to be added to the right-side of the panel's header. */
@@ -30,7 +30,7 @@ export interface PanelProps extends HoistProps, Omit<BoxProps, 'title'> {
30
30
  /** Allow the panel to scroll vertically */
31
31
  scrollable?: boolean;
32
32
  /** A toolbar to be docked at the top of the panel. */
33
- tbar?: Some<ReactNode>;
33
+ tbar?: ReactNode;
34
34
  /** Title text added to the panel's header. */
35
35
  title?: ReactNode;
36
36
  }
@@ -9,7 +9,7 @@ import {reactMarkdown} from '@xh/hoist/kit/react-markdown';
9
9
  import {Options} from 'react-markdown';
10
10
  import remarkBreaks from 'remark-breaks';
11
11
  import remarkGfm from 'remark-gfm';
12
- import {PluggableList} from 'unified/lib';
12
+ import type {PluggableList} from 'unified';
13
13
 
14
14
  interface MarkdownProps extends HoistProps {
15
15
  /** Markdown formatted string to render. */
package/core/elem.ts CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  ReactElement,
16
16
  ReactNode
17
17
  } from 'react';
18
- import {PlainObject, Some, Thunkable} from './types/Types';
18
+ import {PlainObject, Thunkable} from './types/Types';
19
19
 
20
20
  /**
21
21
  * Alternative format for specifying React Elements in render functions. This type is designed to
@@ -45,10 +45,10 @@ export type ElementSpec<P> = Omit<P, 'items' | 'item' | 'omit'> & {
45
45
  // Enhanced attributes to support element factory
46
46
  //---------------------------------------------
47
47
  /** Child Element(s). Equivalent provided as Rest Arguments to React.createElement.*/
48
- items?: Some<ReactNode>;
48
+ items?: ReactNode;
49
49
 
50
50
  /** Equivalent to `items`, offered for code clarity when only one child is needed. */
51
- item?: Some<ReactNode>;
51
+ item?: ReactNode;
52
52
 
53
53
  /** True to exclude the Element. */
54
54
  omit?: Thunkable<boolean>;
@@ -126,7 +126,7 @@ export function elementFactory<C extends ReactComponent>(component: C): ElementF
126
126
  export function elementFactory<P extends PlainObject>(component: ReactComponent): ElementFactory<P>;
127
127
  export function elementFactory(component: ReactComponent): ElementFactory {
128
128
  const ret = function (...args) {
129
- return createElement(component, normalizeArgs(args, component));
129
+ return createElement(component, normalizeArgs(args));
130
130
  };
131
131
  ret.isElementFactory = true;
132
132
  return ret;
@@ -135,7 +135,7 @@ export function elementFactory(component: ReactComponent): ElementFactory {
135
135
  //------------------------
136
136
  // Implementation
137
137
  //------------------------
138
- function normalizeArgs(args: any[], type: any) {
138
+ function normalizeArgs(args: any[]) {
139
139
  const len = args.length;
140
140
  if (len === 0) return {};
141
141
  if (len === 1) {
@@ -4,6 +4,13 @@
4
4
  *
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
+ import ReactGridLayout, {
8
+ type LayoutItem,
9
+ type GridLayoutProps,
10
+ useContainerWidth,
11
+ getCompactor
12
+ } from 'react-grid-layout';
13
+ import {GridBackground, type GridBackgroundProps} from 'react-grid-layout/extras';
7
14
  import {showContextMenu} from '@xh/hoist/kit/blueprint';
8
15
  import composeRefs from '@seznam/compose-react-refs';
9
16
  import {div, vbox, vspacer} from '@xh/hoist/cmp/layout';
@@ -18,10 +25,8 @@ import {
18
25
  import {dashCanvasAddViewButton} from '@xh/hoist/desktop/cmp/button/DashCanvasAddViewButton';
19
26
  import '@xh/hoist/desktop/register';
20
27
  import {Classes, overlay} from '@xh/hoist/kit/blueprint';
21
- import {consumeEvent, TEST_ID} from '@xh/hoist/utils/js';
28
+ import {consumeEvent, mergeDeep, TEST_ID} from '@xh/hoist/utils/js';
22
29
  import classNames from 'classnames';
23
- import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
24
- import type {ReactGridLayoutProps} from 'react-grid-layout';
25
30
  import {DashCanvasModel} from './DashCanvasModel';
26
31
  import {dashCanvasContextMenu} from './impl/DashCanvasContextMenu';
27
32
  import {dashCanvasView} from './impl/DashCanvasView';
@@ -33,10 +38,10 @@ export interface DashCanvasProps extends HoistProps<DashCanvasModel>, TestSuppor
33
38
  /**
34
39
  * Optional additional configuration options to pass through to the underlying ReactGridLayout component.
35
40
  * See the RGL documentation for details:
36
- * {@link https://www.npmjs.com/package/react-grid-layout#grid-layout-props}
41
+ * {@link https://www.npmjs.com/package/react-grid-layout#api-reference}
37
42
  * Note that some ReactGridLayout props are managed directly by DashCanvas and will be overridden if provided here.
38
43
  */
39
- rglOptions?: ReactGridLayoutProps;
44
+ rglOptions?: Partial<GridLayoutProps>;
40
45
  }
41
46
 
42
47
  /**
@@ -58,7 +63,7 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
58
63
  render({className, model, rglOptions, testId}, ref) {
59
64
  const isDraggable = !model.layoutLocked,
60
65
  isResizable = !model.layoutLocked,
61
- [padX, padY] = model.containerPadding;
66
+ {width, containerRef, mounted} = useContainerWidth();
62
67
 
63
68
  return refreshContextView({
64
69
  model: model.refreshContextModel,
@@ -68,37 +73,51 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
68
73
  isDraggable ? `${className}--draggable` : null,
69
74
  isResizable ? `${className}--resizable` : null
70
75
  ),
71
- style: {padding: `${padY}px ${padX}px`},
72
- ref: composeRefs(ref, model.ref),
76
+ ref: composeRefs(ref, model.ref, containerRef),
73
77
  onContextMenu: e => onContextMenu(e, model),
74
78
  items: [
79
+ gridBackgroundCells({
80
+ omit: !model.showGridBackground || !mounted,
81
+ width
82
+ }),
75
83
  reactGridLayout({
84
+ ...mergeDeep(
85
+ {
86
+ gridConfig: {
87
+ cols: model.columns,
88
+ rowHeight: model.rowHeight,
89
+ margin: model.margin,
90
+ maxRows: model.maxRows,
91
+ containerPadding: model.containerPadding
92
+ },
93
+ dragConfig: {
94
+ enabled: isDraggable,
95
+ handle: '.xh-dash-tab.xh-panel > .xh-panel__content > .xh-panel-header',
96
+ cancel: '.xh-button',
97
+ bounded: true
98
+ },
99
+ resizeConfig: {
100
+ enabled: isResizable
101
+ },
102
+ compactor: getCompactor(model.compact, false, false),
103
+ onLayoutChange: (layout: LayoutItem[]) =>
104
+ model.onRglLayoutChange(layout),
105
+ onResizeStart: () => (model.isResizing = true),
106
+ onResizeStop: () => (model.isResizing = false)
107
+ },
108
+ rglOptions
109
+ ),
110
+ omit: !mounted,
76
111
  layout: model.rglLayout,
77
- cols: model.columns,
78
- rowHeight: model.rowHeight,
79
- isDraggable,
80
- isResizable,
81
- compactType: model.compact ? 'vertical' : null,
82
- margin: model.margin,
83
- maxRows: model.maxRows,
84
- containerPadding: [0, 0], // Workaround for https://github.com/react-grid-layout/react-grid-layout/issues/1990
85
- autoSize: true,
86
- isBounded: true,
87
- draggableHandle:
88
- '.xh-dash-tab.xh-panel > .xh-panel__content > .xh-panel-header',
89
- draggableCancel: '.xh-button',
90
- onLayoutChange: layout => model.onRglLayoutChange(layout),
91
- onResizeStart: () => (model.isResizing = true),
92
- onResizeStop: () => (model.isResizing = false),
93
- items: model.viewModels.map(vm =>
112
+ children: model.viewModels.map(vm =>
94
113
  div({
95
114
  key: vm.id,
96
115
  item: dashCanvasView({model: vm})
97
116
  })
98
117
  ),
99
- ...rglOptions
118
+ width
100
119
  }),
101
- emptyContainerOverlay()
120
+ emptyContainerOverlay({omit: !mounted})
102
121
  ],
103
122
  [TEST_ID]: testId
104
123
  })
@@ -106,6 +125,24 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
106
125
  }
107
126
  });
108
127
 
128
+ const gridBackgroundCells = hoistCmp.factory<DashCanvasModel>({
129
+ displayName: 'DashCanvasGridBackgroundCells',
130
+ model: uses(DashCanvasModel),
131
+ render({model, width}) {
132
+ return gridBackground({
133
+ className: 'xh-dash-canvas__grid-background',
134
+ width,
135
+ height: model.rglHeight,
136
+ cols: model.columns,
137
+ rowHeight: model.rowHeight,
138
+ margin: model.margin,
139
+ rows: 'auto',
140
+ color: 'var(--xh-dash-canvas-grid-cell-color)',
141
+ borderRadius: 0
142
+ });
143
+ }
144
+ });
145
+
109
146
  const emptyContainerOverlay = hoistCmp.factory<DashCanvasModel>(({model}) => {
110
147
  const {isEmpty, emptyText} = model;
111
148
  if (!isEmpty) return null;
@@ -147,4 +184,5 @@ const onContextMenu = (e, model) => {
147
184
  }
148
185
  };
149
186
 
150
- const reactGridLayout = elementFactory(WidthProvider(ReactGridLayout));
187
+ const reactGridLayout = elementFactory<GridLayoutProps>(ReactGridLayout);
188
+ const gridBackground = elementFactory<GridBackgroundProps>(GridBackground);