@balena/ui-shared-components 15.2.3-build-material-7-4dc34ee41185e13821a04786ce23979ed0e848da-1 → 15.2.3-build-material-7-36076d224af2d4134f2375ef50f71e060cce68e0-1
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.
|
@@ -10,7 +10,7 @@ export const ObjectFieldTemplate = (props) => {
|
|
|
10
10
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
11
11
|
return (_jsxs(_Fragment, { children: [title && (_jsx(TitleFieldTemplate, { id: titleId(fieldPathId), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(fieldPathId), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs(Grid, Object.assign({ container: true, spacing: 2, style: { marginTop: '10px' } }, ((_b = (_a = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:grid']) === null || _a === void 0 ? void 0 : _a.container) !== null && _b !== void 0 ? _b : {}), { children: [properties.map((element, index) => {
|
|
12
12
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
13
|
-
return element.hidden ? (element.content) : (_jsx(Grid, Object.assign({ item: true,
|
|
13
|
+
return element.hidden ? (element.content) : (_jsx(Grid, Object.assign({ item: true, size: 12, sx: { marginBottom: '10px' } }, ((_g = (_e = (_c = (_b = (_a = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[element.name]) === null || _a === void 0 ? void 0 : _a['ui:grid']) === null || _b === void 0 ? void 0 : _b.item) !== null && _c !== void 0 ? _c : (_d = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:grid']) === null || _d === void 0 ? void 0 : _d[element.name]) !== null && _e !== void 0 ? _e : (_f = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['ui:grid']) === null || _f === void 0 ? void 0 : _f.item) !== null && _g !== void 0 ? _g : {}), { children: element.content }), index));
|
|
14
14
|
}), canExpand(schema, uiSchema, formData) && (_jsx(Grid, { container: true, justifyContent: "flex-end", children: _jsx(Grid, { children: _jsx(AddButton, { className: "object-property-expand", onClick: onAddProperty,
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- If `disabled` is false, we still want to disable the button if `readonly` is true
|
|
16
16
|
disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }))] }))] }));
|
|
@@ -7,7 +7,6 @@ import { PasswordWidget } from './Widgets/PasswordWidget';
|
|
|
7
7
|
import { SelectWidget } from './Widgets/SelectWidget';
|
|
8
8
|
import { FileWidget } from './Widgets/FileWidget';
|
|
9
9
|
import { Fragment, forwardRef } from 'react';
|
|
10
|
-
import { ObjectFieldTemplate } from './FieldTemplates/ObjectFieldTemplate';
|
|
11
10
|
import { Templates } from '@rjsf/mui';
|
|
12
11
|
const internalWidgets = {
|
|
13
12
|
PasswordWidget,
|
|
@@ -23,7 +22,7 @@ const FormWrapper = styled('div')({
|
|
|
23
22
|
export const RJSForm = forwardRef(function RJSForm(_a, ref) {
|
|
24
23
|
var { hideSubmitButton, submitButtonProps, actionButtons, validator = ajvValidator, widgets, children, sx, onFocus, onBlur, onClick, templates } = _a, otherProps = __rest(_a, ["hideSubmitButton", "submitButtonProps", "actionButtons", "validator", "widgets", "children", "sx", "onFocus", "onBlur", "onClick", "templates"]);
|
|
25
24
|
// paddingY is resolving an outline glitch that is truncated when inside a container.
|
|
26
|
-
return (_jsx(FormWrapper, { children: _jsx(Box, { sx: Object.assign({ paddingY: '1px' }, sx), onFocus: onFocus, onBlur: onBlur, onClick: onClick, children: _jsxs(Form, Object.assign({ ref: ref, validator: validator, showErrorList: false, widgets: Object.assign(Object.assign({}, internalWidgets), (widgets !== null && widgets !== void 0 ? widgets : {})), templates:
|
|
25
|
+
return (_jsx(FormWrapper, { children: _jsx(Box, { sx: Object.assign({ paddingY: '1px' }, sx), onFocus: onFocus, onBlur: onBlur, onClick: onClick, children: _jsxs(Form, Object.assign({ ref: ref, validator: validator, showErrorList: false, widgets: Object.assign(Object.assign({}, internalWidgets), (widgets !== null && widgets !== void 0 ? widgets : {})), templates: templates }, otherProps, { children: [hideSubmitButton && _jsx(Fragment, {}), actionButtons === null || actionButtons === void 0 ? void 0 : actionButtons.map((_a, index) => {
|
|
27
26
|
var { sx: actionButtonSx } = _a, buttonProps = __rest(_a, ["sx"]);
|
|
28
27
|
return (_jsx(Button, Object.assign({ sx: [
|
|
29
28
|
{
|
|
@@ -13,15 +13,20 @@ import { findInObject } from '../../utils';
|
|
|
13
13
|
import { getRefSchema } from '../../schemaOps';
|
|
14
14
|
import { DialogWithCloseButton } from '../../../DialogWithCloseButton';
|
|
15
15
|
import { RJSForm } from '../../../Form';
|
|
16
|
-
|
|
16
|
+
import { ObjectFieldTemplate } from '../../../Form/FieldTemplates/ObjectFieldTemplate';
|
|
17
|
+
const ArrayFieldTemplate = ({ items, canAdd, onAddClick, }) => {
|
|
17
18
|
const { t } = useTranslation();
|
|
18
|
-
return (_jsxs(Box, { children: [
|
|
19
|
+
return (_jsxs(Box, { className: "array", children: [items, canAdd && (_jsx(Box, { className: "rjsf-array-item-add", children: _jsx(Button, { "aria-label": t('aria_labels.add_filter_in_or'), variant: "text", color: "primary", onClick: onAddClick, startIcon: _jsx(FontAwesomeIcon, { icon: faPlus }), children: t('actions.add_alternative') }) }))] }));
|
|
20
|
+
};
|
|
21
|
+
const ArrayFieldItemTemplate = ({ children, buttonsProps, itemKey, index, }) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
return (_jsxs(Box, { className: "rjsf-array-item", children: [index > 0 && (_jsx(Typography, { sx: {
|
|
19
24
|
width: 'calc(100% - 50px)',
|
|
20
25
|
textAlign: 'center',
|
|
21
26
|
fontWeight: 'bold',
|
|
22
27
|
}, children: t('commons.or').toUpperCase() })), _jsxs(Box, { sx: {
|
|
23
28
|
display: 'flex',
|
|
24
|
-
'& .
|
|
29
|
+
'& .rjsf-field.rjsf-field-object': {
|
|
25
30
|
display: 'flex',
|
|
26
31
|
flex: 1,
|
|
27
32
|
},
|
|
@@ -29,10 +34,10 @@ const ArrayFieldItemTemplate = ({ children, buttonsProps, itemKey, index, totalI
|
|
|
29
34
|
display: 'none',
|
|
30
35
|
},
|
|
31
36
|
// This is necessary to remove the gap of Tags label. RJSF render nested objects with multi label levels.
|
|
32
|
-
'.MuiGrid-root > .
|
|
37
|
+
'.MuiGrid-root > .rjsf-field.rjsf-field-object > .MuiFormControl-root > .MuiGrid-root.MuiGrid-container.MuiGrid-spacing-xs-2': {
|
|
33
38
|
marginTop: '-8px!important',
|
|
34
39
|
},
|
|
35
|
-
}, children: [children, _jsx(Box, { display: "flex", width: "50px", alignItems: "center", justifyContent: "center", children: index !== 0 && (_jsx(IconButton, { "aria-label": t('actions.remove_filter'), onClick: buttonsProps.onRemoveItem, sx: { mt: 2 },
|
|
40
|
+
}, children: [children, _jsx(Box, { display: "flex", width: "50px", alignItems: "center", justifyContent: "center", children: index !== 0 && (_jsx(IconButton, { "aria-label": t('actions.remove_filter'), onClick: buttonsProps.onRemoveItem, sx: { mt: 2 }, className: "rjsf-array-item-remove", children: _jsx(FontAwesomeIcon, { icon: faTimes }) })) })] })] }, itemKey));
|
|
36
41
|
};
|
|
37
42
|
const widgets = {
|
|
38
43
|
CheckboxWidget: SelectWidget,
|
|
@@ -149,9 +154,9 @@ export const FiltersDialog = ({ schema, data = initialFormData, onClose, }) => {
|
|
|
149
154
|
},
|
|
150
155
|
uiSchema: {
|
|
151
156
|
'ui:grid': {
|
|
152
|
-
field: { xs: 4, sm: 4 },
|
|
153
|
-
operator: { xs: 4, sm: 4 },
|
|
154
|
-
value: { xs: 4, sm: 4 },
|
|
157
|
+
field: { size: { xs: 4, sm: 4 } },
|
|
158
|
+
operator: { size: { xs: 4, sm: 4 } },
|
|
159
|
+
value: { size: { xs: 4, sm: 4 } },
|
|
155
160
|
},
|
|
156
161
|
field: {
|
|
157
162
|
'ui:readonly': true,
|
|
@@ -172,12 +177,13 @@ export const FiltersDialog = ({ schema, data = initialFormData, onClose, }) => {
|
|
|
172
177
|
const: key,
|
|
173
178
|
}));
|
|
174
179
|
const uiSchema = {
|
|
180
|
+
'ui:ArrayFieldTemplate': ArrayFieldTemplate,
|
|
175
181
|
'ui:ArrayFieldItemTemplate': ArrayFieldItemTemplate,
|
|
176
182
|
items: {
|
|
177
183
|
'ui:grid': {
|
|
178
|
-
field: { xs: 4, sm: 4 },
|
|
179
|
-
operator: { xs: 4, sm: 4 },
|
|
180
|
-
value: { xs: 4, sm: 4 },
|
|
184
|
+
field: { size: { xs: 4, sm: 4 } },
|
|
185
|
+
operator: { size: { xs: 4, sm: 4 } },
|
|
186
|
+
value: { size: { xs: 4, sm: 4 } },
|
|
181
187
|
},
|
|
182
188
|
value: {},
|
|
183
189
|
},
|
|
@@ -239,5 +245,5 @@ export const FiltersDialog = ({ schema, data = initialFormData, onClose, }) => {
|
|
|
239
245
|
onClick: () => {
|
|
240
246
|
setIsFirstValidation(false);
|
|
241
247
|
},
|
|
242
|
-
} })) }) }));
|
|
248
|
+
}, templates: { ObjectFieldTemplate } })) }) }));
|
|
243
249
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "15.2.3-build-material-7-
|
|
3
|
+
"version": "15.2.3-build-material-7-36076d224af2d4134f2375ef50f71e060cce68e0-1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
|
20
20
|
"@fortawesome/react-fontawesome": "^3.1.0",
|
|
21
21
|
"@mui/lab": "7.0.0-beta.14",
|
|
22
|
-
"@mui/material": "^7.
|
|
23
|
-
"@mui/styled-engine-sc": "^7.
|
|
22
|
+
"@mui/material": "^7.3.5",
|
|
23
|
+
"@mui/styled-engine-sc": "^7.3.5",
|
|
24
24
|
"@mui/x-data-grid": "^7.29.8",
|
|
25
25
|
"@react-google-maps/api": "^2.18.1",
|
|
26
26
|
"@rjsf/core": "^6.0.1",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
},
|
|
136
136
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
137
137
|
"versionist": {
|
|
138
|
-
"publishedAt": "2025-11-
|
|
138
|
+
"publishedAt": "2025-11-06T17:55:54.553Z"
|
|
139
139
|
},
|
|
140
140
|
"overrides": {
|
|
141
141
|
"storybook": "$storybook",
|