@xh/hoist 76.0.0-SNAPSHOT.1757949377824 → 76.0.0-SNAPSHOT.1758029355620
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
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
practice. App maintainers should ensure that all global views are appropriate and well
|
|
24
24
|
organized enough to be shown immediately to new users in the view menu.
|
|
25
25
|
* New constraint rule: `validEmails` - to validate one or more email addresses in an input field.
|
|
26
|
+
* `DashCanvas` accepts a new prop `rglOptions` to pass additional options to the underlying
|
|
27
|
+
`react-grid-layout`.
|
|
26
28
|
|
|
27
29
|
### 🐞 Bug Fixes
|
|
28
30
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { HoistProps, TestSupportProps } from '@xh/hoist/core';
|
|
2
2
|
import '@xh/hoist/desktop/register';
|
|
3
|
+
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
3
4
|
import { DashCanvasModel } from './DashCanvasModel';
|
|
4
5
|
import 'react-grid-layout/css/styles.css';
|
|
5
6
|
import './DashCanvas.scss';
|
|
6
|
-
export
|
|
7
|
+
export interface DashCanvasProps extends HoistProps<DashCanvasModel>, TestSupportProps {
|
|
8
|
+
/**
|
|
9
|
+
* Optional additional configuration options to pass through to the underlying ReactGridLayout component.
|
|
10
|
+
* See the RGL documentation for details:
|
|
11
|
+
* {@link https://www.npmjs.com/package/react-grid-layout#grid-layout-props}
|
|
12
|
+
* Note that some ReactGridLayout props are managed directly by DashCanvas and will be overridden if provided here.
|
|
13
|
+
*/
|
|
14
|
+
rglOptions?: ReactGridLayoutProps;
|
|
15
|
+
}
|
|
7
16
|
/**
|
|
8
17
|
* Dashboard-style container that allows users to drag-and-drop child widgets into flexible layouts.
|
|
9
18
|
*
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
import {LocalDate} from '@xh/hoist/utils/datetime';
|
|
8
|
+
import {pluralize} from '@xh/hoist/utils/js';
|
|
8
9
|
import {isArray, isEmpty, isFinite, isNil, isString, uniq} from 'lodash';
|
|
9
10
|
import moment from 'moment';
|
|
10
11
|
import {Constraint} from './Rule';
|
|
@@ -43,21 +44,21 @@ export const validEmail: Constraint<string> = ({value, displayName}) => {
|
|
|
43
44
|
*/
|
|
44
45
|
export function validEmails(c?: ValidEmailsOptions): Constraint<string> {
|
|
45
46
|
return ({value, displayName}) => {
|
|
46
|
-
if (isNil(value)) return null;
|
|
47
|
+
if (isNil(value) && !c?.minCount) return null;
|
|
47
48
|
|
|
48
|
-
const emails = value
|
|
49
|
+
const emails = (value ?? '')
|
|
49
50
|
.split(';')
|
|
50
51
|
.map(it => it.trim())
|
|
51
52
|
.filter(Boolean);
|
|
52
53
|
|
|
53
54
|
if (uniq(emails).length !== emails.length) {
|
|
54
|
-
return `${displayName} must not contain duplicate
|
|
55
|
+
return `${displayName} must not contain duplicate emails.`;
|
|
55
56
|
}
|
|
56
57
|
if (emails.length < c?.minCount) {
|
|
57
|
-
return `${displayName} must contain at least ${c.minCount} email
|
|
58
|
+
return `${displayName} must contain at least ${c.minCount} ${pluralize('email', c.minCount)}.`;
|
|
58
59
|
}
|
|
59
60
|
if (!isNil(c?.maxCount) && emails.length > c.maxCount) {
|
|
60
|
-
return `${displayName} must contain no more than ${c.maxCount} email
|
|
61
|
+
return `${displayName} must contain no more than ${c.maxCount} ${pluralize('email', c.maxCount)}.`;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
const isValid = emails.every(it => emailRegEx.test(it));
|
|
@@ -21,6 +21,7 @@ import {Classes, overlay} from '@xh/hoist/kit/blueprint';
|
|
|
21
21
|
import {consumeEvent, TEST_ID} from '@xh/hoist/utils/js';
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
|
|
24
|
+
import type {ReactGridLayoutProps} from 'react-grid-layout';
|
|
24
25
|
import {DashCanvasModel} from './DashCanvasModel';
|
|
25
26
|
import {dashCanvasContextMenu} from './impl/DashCanvasContextMenu';
|
|
26
27
|
import {dashCanvasView} from './impl/DashCanvasView';
|
|
@@ -28,7 +29,15 @@ import {dashCanvasView} from './impl/DashCanvasView';
|
|
|
28
29
|
import 'react-grid-layout/css/styles.css';
|
|
29
30
|
import './DashCanvas.scss';
|
|
30
31
|
|
|
31
|
-
export
|
|
32
|
+
export interface DashCanvasProps extends HoistProps<DashCanvasModel>, TestSupportProps {
|
|
33
|
+
/**
|
|
34
|
+
* Optional additional configuration options to pass through to the underlying ReactGridLayout component.
|
|
35
|
+
* See the RGL documentation for details:
|
|
36
|
+
* {@link https://www.npmjs.com/package/react-grid-layout#grid-layout-props}
|
|
37
|
+
* Note that some ReactGridLayout props are managed directly by DashCanvas and will be overridden if provided here.
|
|
38
|
+
*/
|
|
39
|
+
rglOptions?: ReactGridLayoutProps;
|
|
40
|
+
}
|
|
32
41
|
|
|
33
42
|
/**
|
|
34
43
|
* Dashboard-style container that allows users to drag-and-drop child widgets into flexible layouts.
|
|
@@ -46,7 +55,7 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
|
|
|
46
55
|
className: 'xh-dash-canvas',
|
|
47
56
|
model: uses(DashCanvasModel),
|
|
48
57
|
|
|
49
|
-
render({className, model, testId}, ref) {
|
|
58
|
+
render({className, model, rglOptions, testId}, ref) {
|
|
50
59
|
const isDraggable = !model.layoutLocked,
|
|
51
60
|
isResizable = !model.layoutLocked,
|
|
52
61
|
[padX, padY] = model.containerPadding;
|
|
@@ -86,7 +95,8 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
|
|
|
86
95
|
key: vm.id,
|
|
87
96
|
item: dashCanvasView({model: vm})
|
|
88
97
|
})
|
|
89
|
-
)
|
|
98
|
+
),
|
|
99
|
+
...rglOptions
|
|
90
100
|
}),
|
|
91
101
|
emptyContainerOverlay()
|
|
92
102
|
],
|
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.1758029355620",
|
|
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",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@ag-grid-community/react": "31.x",
|
|
97
97
|
"@types/react": "18.x",
|
|
98
98
|
"@types/react-dom": "18.x",
|
|
99
|
+
"@types/react-grid-layout": "1.3.5",
|
|
99
100
|
"@xh/hoist-dev-utils": "11.x",
|
|
100
101
|
"csstype": "3.x",
|
|
101
102
|
"eslint": "9.x",
|