@sphereon/ui-components.ssi-react 0.4.1-unstable.73 → 0.4.1-unstable.75

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.
@@ -9,15 +9,25 @@ const CustomArrayControl = (props) => {
9
9
  const { data = [], handleChange, path, schema, uischema, label } = props;
10
10
  const elements = uischema.options?.detail?.elements || [];
11
11
  const itemSchema = schema.items && !Array.isArray(schema.items) ? schema.items : {};
12
- const handleAdd = async () => {
13
- handleChange(path, [...data, {}]);
12
+ const handleAdd = async (index) => {
13
+ if (index !== undefined) {
14
+ const targetItem = { ...data[index] };
15
+ targetItem.properties = targetItem.properties ?? [];
16
+ targetItem.properties.push({});
17
+ data[index] = targetItem;
18
+ handleChange(path, [...data]);
19
+ }
20
+ else {
21
+ handleChange(path, [...data, {}]);
22
+ }
14
23
  };
15
24
  const handleRemove = async (index) => {
16
25
  const newData = data.filter((_, i) => i !== index);
17
26
  handleChange(path, newData);
18
27
  };
19
28
  const getItemElements = () => {
20
- return data.map((item, index) => _jsx("div", { style: { display: 'flex', flexDirection: 'row', gap: 12 }, children: _jsx("div", { style: { display: 'flex', flexDirection: 'row', borderRadius: 8, overflow: 'hidden', width: '100%' }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 24, width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', gap: 24, padding: 24, border: '1px solid #C4C4C4', borderRadius: 8, flexGrow: 1, alignItems: 'center' }, children: getFieldElements(elements, `${path}.${index}`) }), _jsx(IconButton, { icon: ButtonIcon.DELETE, onClick: () => handleRemove(index) })] }), item?.type === 'object' &&
29
+ return data.map((item, index) => _jsx("div", { style: { display: 'flex', flexDirection: 'row', gap: 12 }, children: _jsx("div", { style: { display: 'flex', flexDirection: 'row', borderRadius: 8, overflow: 'hidden', width: '100%' }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', gap: 24, padding: 24, border: '1px solid #C4C4C4', borderRadius: 8, flexGrow: 1, alignItems: 'center' }, children: getFieldElements(elements, `${path}.${index}`) }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 24 }, children: [_jsx(IconButton, { icon: ButtonIcon.DELETE, onClick: () => handleRemove(index) }), item?.type === 'object' &&
30
+ _jsx(IconButton, { icon: ButtonIcon.ADD, onClick: () => handleAdd(index) })] })] }), item?.type === 'object' &&
21
31
  _jsx("div", { style: { marginLeft: 24, display: 'flex', flexDirection: 'row' }, children: getChildFieldElements(elements, `${path}.${index}.properties`) })] }) }) }, index));
22
32
  };
23
33
  const getFieldElements = (elements, path) => {
@@ -49,11 +59,12 @@ const CustomArrayControl = (props) => {
49
59
  return (_jsx(JsonFormsDispatch, { uischema: childrenUiSchema, schema: resolvedChildrenSchema, path: path }, i));
50
60
  });
51
61
  };
52
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 28, width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("div", { style: { color: 'black', fontSize: 16, fontWeight: '400' }, children: label }), _jsx(PrimaryButton, { caption: uischema.options?.addLabel || '+', onClick: handleAdd, style: {
53
- marginLeft: 'auto',
54
- height: 33,
55
- width: 120
56
- } })] }), getItemElements()] }));
62
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 28, width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("div", { style: { color: 'black', fontSize: 16, fontWeight: '400' }, children: label }), !uischema.options?.isChild &&
63
+ _jsx(PrimaryButton, { caption: uischema.options?.addLabel || '+', onClick: handleAdd, style: {
64
+ marginLeft: 'auto',
65
+ height: 33,
66
+ width: 120
67
+ } })] }), getItemElements()] }));
57
68
  };
58
69
  export const customArrayControlTester = rankWith(5, and(isArrayObjectControl, optionIs('type', JsonFormsCustomControlKey.ARRAY)));
59
70
  export default withJsonFormsControlProps(CustomArrayControl);
@@ -103,3 +103,14 @@ textarea.MuiInputBase-input.MuiInputBase-inputMultiline {
103
103
  .MuiTabs-scroller.MuiTabs-fixed {
104
104
  margin-bottom: 12px !important;
105
105
  }
106
+
107
+ .MuiFormHelperText-root {
108
+ display: none;
109
+ }
110
+ .MuiFormHelperText-root:empty {
111
+ display: none;
112
+ }
113
+
114
+ .MuiFormControlLabel-root {
115
+ height: fit-content;
116
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sphereon/ui-components.ssi-react",
3
3
  "private": false,
4
- "version": "0.4.1-unstable.73+1104ba0",
4
+ "version": "0.4.1-unstable.75+c8f69b8",
5
5
  "description": "SSI UI components for React",
6
6
  "repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
7
7
  "author": "Sphereon <dev@sphereon.com>",
@@ -50,7 +50,7 @@
50
50
  "@mui/x-date-pickers": "^6.19.5",
51
51
  "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.45.94",
52
52
  "@sphereon/ssi-types": "0.34.1-feature.SSISDK.45.94",
53
- "@sphereon/ui-components.core": "0.4.1-unstable.73+1104ba0",
53
+ "@sphereon/ui-components.core": "0.4.1-unstable.75+c8f69b8",
54
54
  "@tanstack/react-table": "^8.9.3",
55
55
  "ajv": "^8.17.1",
56
56
  "ajv-formats": "^3.0.1",
@@ -71,5 +71,5 @@
71
71
  "peerDependencies": {
72
72
  "react": ">= 18"
73
73
  },
74
- "gitHead": "1104ba037015a5d1b3d426221ad8d329f0f08fed"
74
+ "gitHead": "c8f69b89cf3067ed96519c7647565c6066acb10f"
75
75
  }