@xh/hoist 76.0.0-SNAPSHOT.1756219543970 → 76.0.0-SNAPSHOT.1756402657806
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.
|
@@ -6,19 +6,28 @@ import { RestGridModel } from './RestGridModel';
|
|
|
6
6
|
export interface RestGridProps extends HoistProps<RestGridModel>, Omit<PanelProps, 'model' | 'modelConfig' | 'modelRef'> {
|
|
7
7
|
/**
|
|
8
8
|
* This constitutes an 'escape hatch' for applications that need to get to the underlying
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* AG Grid API. Use with care - settings made here might be overwritten and/or interfere with
|
|
10
|
+
* the implementation of this component and its use of AG Grid.
|
|
11
11
|
*/
|
|
12
12
|
agOptions?: PlainObject;
|
|
13
|
-
/** Optional components rendered adjacent to the top toolbar's action buttons */
|
|
14
|
-
extraToolbarItems?: Some<ReactNode> | (() => Some<ReactNode>);
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* specifying a Mask instance.
|
|
14
|
+
* Optional components rendered adjacent to the top toolbar's action buttons.
|
|
15
|
+
* See also {@link tbar} to take full control of the toolbar.
|
|
19
16
|
*/
|
|
20
|
-
|
|
17
|
+
extraToolbarItems?: Some<ReactNode> | (() => Some<ReactNode>);
|
|
21
18
|
/** Classname to be passed to RestForm. */
|
|
22
19
|
formClassName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Mask to render on this Component. Defaults to true, which renders a standard Hoist mask.
|
|
22
|
+
* Set to null/false for no mask, or pass a fully customized mask element.
|
|
23
|
+
*/
|
|
24
|
+
mask?: ReactElement | boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A custom toolbar to be docked above the grid. Note that this supersedes the default
|
|
27
|
+
* toolbar, meaning the `extraToolbarItems` prop will be ignored, as will the `RestGridModel`
|
|
28
|
+
* configs `toolbarActions`, `filterFields`, and `showRefreshButton`. If specified as an array,
|
|
29
|
+
* will be passed as children to a Toolbar component.
|
|
30
|
+
*/
|
|
31
|
+
tbar?: Some<ReactNode>;
|
|
23
32
|
}
|
|
24
33
|
export declare const RestGrid: import("react").FC<RestGridProps>, restGrid: import("@xh/hoist/core").ElementFactory<RestGridProps>;
|
|
@@ -10,8 +10,10 @@ import {fragment} from '@xh/hoist/cmp/layout';
|
|
|
10
10
|
import {hoistCmp, HoistProps, PlainObject, Some, uses} from '@xh/hoist/core';
|
|
11
11
|
import {MaskProps} from '@xh/hoist/cmp/mask';
|
|
12
12
|
import {panel, PanelProps} from '@xh/hoist/desktop/cmp/panel';
|
|
13
|
+
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
|
|
13
14
|
import '@xh/hoist/desktop/register';
|
|
14
15
|
import {getTestId} from '@xh/hoist/utils/js';
|
|
16
|
+
import {isArray} from 'lodash';
|
|
15
17
|
import {cloneElement, isValidElement, ReactElement, ReactNode} from 'react';
|
|
16
18
|
|
|
17
19
|
import {restForm} from './impl/RestForm';
|
|
@@ -23,23 +25,33 @@ export interface RestGridProps
|
|
|
23
25
|
Omit<PanelProps, 'model' | 'modelConfig' | 'modelRef'> {
|
|
24
26
|
/**
|
|
25
27
|
* This constitutes an 'escape hatch' for applications that need to get to the underlying
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* AG Grid API. Use with care - settings made here might be overwritten and/or interfere with
|
|
29
|
+
* the implementation of this component and its use of AG Grid.
|
|
28
30
|
*/
|
|
29
31
|
agOptions?: PlainObject;
|
|
30
32
|
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Optional components rendered adjacent to the top toolbar's action buttons.
|
|
35
|
+
* See also {@link tbar} to take full control of the toolbar.
|
|
36
|
+
*/
|
|
32
37
|
extraToolbarItems?: Some<ReactNode> | (() => Some<ReactNode>);
|
|
33
38
|
|
|
39
|
+
/** Classname to be passed to RestForm. */
|
|
40
|
+
formClassName?: string;
|
|
41
|
+
|
|
34
42
|
/**
|
|
35
|
-
* Mask to render on this Component. Defaults to true, which renders a standard
|
|
36
|
-
*
|
|
37
|
-
* specifying a Mask instance.
|
|
43
|
+
* Mask to render on this Component. Defaults to true, which renders a standard Hoist mask.
|
|
44
|
+
* Set to null/false for no mask, or pass a fully customized mask element.
|
|
38
45
|
*/
|
|
39
46
|
mask?: ReactElement | boolean;
|
|
40
47
|
|
|
41
|
-
/**
|
|
42
|
-
|
|
48
|
+
/**
|
|
49
|
+
* A custom toolbar to be docked above the grid. Note that this supersedes the default
|
|
50
|
+
* toolbar, meaning the `extraToolbarItems` prop will be ignored, as will the `RestGridModel`
|
|
51
|
+
* configs `toolbarActions`, `filterFields`, and `showRefreshButton`. If specified as an array,
|
|
52
|
+
* will be passed as children to a Toolbar component.
|
|
53
|
+
*/
|
|
54
|
+
tbar?: Some<ReactNode>;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
export const [RestGrid, restGrid] = hoistCmp.withFactory<RestGridProps>({
|
|
@@ -51,6 +63,7 @@ export const [RestGrid, restGrid] = hoistCmp.withFactory<RestGridProps>({
|
|
|
51
63
|
const {
|
|
52
64
|
model,
|
|
53
65
|
extraToolbarItems,
|
|
66
|
+
tbar,
|
|
54
67
|
mask = true,
|
|
55
68
|
agOptions,
|
|
56
69
|
formClassName,
|
|
@@ -63,7 +76,7 @@ export const [RestGrid, restGrid] = hoistCmp.withFactory<RestGridProps>({
|
|
|
63
76
|
panel({
|
|
64
77
|
ref,
|
|
65
78
|
...restProps,
|
|
66
|
-
tbar:
|
|
79
|
+
tbar: innerToolbar({model, tbar, extraToolbarItems, testId}),
|
|
67
80
|
item: grid({model: gridModel, agOptions, testId: getTestId(testId, 'grid')}),
|
|
68
81
|
mask: getMaskFromProp(model, mask)
|
|
69
82
|
}),
|
|
@@ -76,6 +89,14 @@ export const [RestGrid, restGrid] = hoistCmp.withFactory<RestGridProps>({
|
|
|
76
89
|
}
|
|
77
90
|
});
|
|
78
91
|
|
|
92
|
+
const innerToolbar = hoistCmp.factory({
|
|
93
|
+
render({model, tbar, extraToolbarItems, testId}) {
|
|
94
|
+
if (isArray(tbar)) return toolbar(tbar);
|
|
95
|
+
if (tbar) return tbar;
|
|
96
|
+
return restGridToolbar({model, extraToolbarItems, testId});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
79
100
|
function getMaskFromProp(model, mask) {
|
|
80
101
|
if (isValidElement(mask)) {
|
|
81
102
|
mask = cloneElement<MaskProps>(mask, {bind: model.loadModel});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "76.0.0-SNAPSHOT.
|
|
3
|
+
"version": "76.0.0-SNAPSHOT.1756402657806",
|
|
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",
|