@sphereon/ui-components.ssi-react 0.4.1-unstable.70 → 0.4.1-unstable.72

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.
@@ -4,21 +4,20 @@ import { materialCells } from '@jsonforms/material-renderers';
4
4
  import { jsonFormsMaterialRenderers } from '../../../renders/jsonFormsRenders';
5
5
  import Ajv from 'ajv';
6
6
  import addFormats from "ajv-formats";
7
+ import { formatDate } from '../../../helpers';
7
8
  const defaultAjv = new Ajv({ useDefaults: true });
8
9
  addFormats(defaultAjv);
9
10
  defaultAjv.addKeyword({
10
- keyword: 'format',
11
+ keyword: 'isoDateFormat',
11
12
  modifying: true,
12
13
  validate: function (schema, data, parentSchema, dataCxt) {
13
14
  if (typeof data === 'string') {
14
- const date = data === 'now' ? new Date() : new Date(data);
15
- if (!isNaN(date.getTime()) && dataCxt?.parentData && dataCxt.parentDataProperty !== undefined) {
16
- dataCxt.parentData[dataCxt.parentDataProperty] =
17
- schema === 'date-time'
18
- ? date.toISOString().slice(0, 19).replace('T', ' ')
19
- : schema === 'date'
20
- ? date.toISOString().slice(0, 10)
21
- : date.toISOString().slice(11, 19);
15
+ if (!dataCxt?.parentData || dataCxt.parentDataProperty === undefined) {
16
+ return true;
17
+ }
18
+ const formatted = formatDate(data, schema);
19
+ if (formatted && formatted !== 'Invalid date') {
20
+ dataCxt.parentData[dataCxt.parentDataProperty] = formatted;
22
21
  }
23
22
  return true;
24
23
  }
@@ -27,9 +26,6 @@ defaultAjv.addKeyword({
27
26
  });
28
27
  const FormView = (props) => {
29
28
  const { data, schema, uiSchema, validationMode = 'ValidateAndShow', renderers = jsonFormsMaterialRenderers, cells = materialCells, style, middleware, ajv = defaultAjv, onFormStateChange, readonly = false, config, } = props;
30
- const onFormStateChanged = (state) => {
31
- void onFormStateChange?.(state);
32
- };
33
- return (_jsx("div", { style: style, children: _jsx(JsonForms, { schema: schema, uischema: uiSchema, data: data, renderers: renderers, onChange: onFormStateChanged, ajv: ajv }) }));
29
+ return (_jsx("div", { style: style, children: _jsx(JsonForms, { schema: schema, uischema: uiSchema, data: data, renderers: renderers, cells: cells, onChange: onFormStateChange, validationMode: validationMode, middleware: middleware, ajv: ajv, readonly: readonly, config: config }) }));
34
30
  };
35
31
  export default FormView;
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.70+e65db69",
4
+ "version": "0.4.1-unstable.72+50389e8",
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.70+e65db69",
53
+ "@sphereon/ui-components.core": "0.4.1-unstable.72+50389e8",
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": "e65db6970832a9096ea7ec0345d0a15c54185797"
74
+ "gitHead": "50389e8dc219258bdd495637f90b6a8ab6f8128c"
75
75
  }