@sphereon/ui-components.ssi-react 0.4.1-unstable.24 → 0.4.1-unstable.26
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.
|
@@ -5,43 +5,29 @@ import { materialCells } from '@jsonforms/material-renderers';
|
|
|
5
5
|
import { jsonFormsMaterialRenderers } from '../../../renders/jsonFormsRenders';
|
|
6
6
|
import { formatDateToISO } from '../../../helpers';
|
|
7
7
|
const initializeDefaultValues = (schema, currentData = {}) => {
|
|
8
|
-
console.log('=== initializeDefaultValues called ===');
|
|
9
|
-
console.log('Schema properties:', Object.keys(schema.properties || {}));
|
|
10
|
-
console.log('Current data:', JSON.stringify(currentData, null, 2));
|
|
11
8
|
const result = { ...currentData };
|
|
12
9
|
if (!schema.properties) {
|
|
13
|
-
console.log('No schema properties, returning current data');
|
|
14
10
|
return result;
|
|
15
11
|
}
|
|
16
12
|
Object.entries(schema.properties).forEach(([key, property]) => {
|
|
17
13
|
if (typeof property === 'object') {
|
|
18
|
-
console.log(`\nProcessing key: ${key}`);
|
|
19
14
|
if (property.const && (!(key in result) || !result[key])) {
|
|
20
|
-
console.log(` Setting const value for ${key}:`, property.const);
|
|
21
15
|
result[key] = property.const;
|
|
22
16
|
}
|
|
23
17
|
if (property.default !== undefined && !(key in result)) {
|
|
24
|
-
console.log(` Found default for ${key}:`, property.default);
|
|
25
18
|
if (property.format?.startsWith('date') || property.format?.startsWith('time')) {
|
|
26
19
|
result[key] = formatDateToISO(property.default, property.format);
|
|
27
|
-
console.log(` Applied date format for ${key}:`, result[key]);
|
|
28
20
|
}
|
|
29
21
|
else if (typeof property.default === 'object') {
|
|
30
22
|
result[key] = Array.isArray(property.default)
|
|
31
23
|
? [...property.default]
|
|
32
24
|
: { ...property.default };
|
|
33
|
-
console.log(` Applied object default for ${key}:`, result[key]);
|
|
34
25
|
}
|
|
35
26
|
else {
|
|
36
27
|
result[key] = property.default;
|
|
37
|
-
console.log(` Applied default for ${key}:`, result[key]);
|
|
38
28
|
}
|
|
39
29
|
}
|
|
40
|
-
else if (key in result) {
|
|
41
|
-
console.log(` Key ${key} already exists in data:`, result[key]);
|
|
42
|
-
}
|
|
43
30
|
if (property.properties) {
|
|
44
|
-
console.log(` Recursing into nested object ${key}`);
|
|
45
31
|
if (!result[key]) {
|
|
46
32
|
result[key] = {};
|
|
47
33
|
}
|
|
@@ -49,8 +35,6 @@ const initializeDefaultValues = (schema, currentData = {}) => {
|
|
|
49
35
|
}
|
|
50
36
|
}
|
|
51
37
|
});
|
|
52
|
-
console.log('=== initializeDefaultValues result ===');
|
|
53
|
-
console.log(JSON.stringify(result, null, 2));
|
|
54
38
|
return result;
|
|
55
39
|
};
|
|
56
40
|
const FormView = (props) => {
|
|
@@ -66,8 +50,12 @@ const FormView = (props) => {
|
|
|
66
50
|
if (!initialized) {
|
|
67
51
|
return;
|
|
68
52
|
}
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
const mergedData = {
|
|
54
|
+
...formData,
|
|
55
|
+
...state.data
|
|
56
|
+
};
|
|
57
|
+
setFormData(mergedData);
|
|
58
|
+
void onFormStateChange?.({ ...state, data: mergedData });
|
|
71
59
|
};
|
|
72
60
|
return (_jsx("div", { style: style, children: _jsx(JsonForms, { schema: schema, uischema: uiSchema, data: formData, renderers: renderers, cells: cells, onChange: onFormStateChanged, validationMode: validationMode, middleware: middleware, ajv: ajv, readonly: readonly, config: config }) }));
|
|
73
61
|
};
|
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.
|
|
4
|
+
"version": "0.4.1-unstable.26+03e779b",
|
|
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.
|
|
53
|
+
"@sphereon/ui-components.core": "0.4.1-unstable.26+03e779b",
|
|
54
54
|
"@tanstack/react-table": "^8.9.3",
|
|
55
55
|
"react-json-tree": "^0.18.0",
|
|
56
56
|
"react-loader-spinner": "5.4.5",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": ">= 18"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "03e779bd9b133494e3e3a21efdc354a768edb66c"
|
|
73
73
|
}
|