From fb965f90e041102830a437b45cb2ecf939c48956 Mon Sep 17 00:00:00 2001 From: Stefan Dirix Date: Wed, 21 Aug 2024 13:15:24 +0200 Subject: [PATCH] chore: polish vue-vuetify integration - adapt to latest 'master' state - fix 'useJsonFormsLabel' composition - align dependency versions over packages - type improvement in core/schema - fix example app --- packages/angular-material/package.json | 2 +- packages/core/src/mappers/renderer.ts | 1 + packages/core/src/util/schema.ts | 31 +++++++++++++------ packages/material-renderers/package.json | 2 +- packages/vue-vuetify/dev/App.vue | 10 +++--- .../dev/components/ExampleDrawer.vue | 9 ++++-- .../vue-vuetify/example/index.bundled.html | 17 ---------- packages/vue-vuetify/index.html | 1 - packages/vue-vuetify/package.json | 4 +-- .../components/AdditionalProperties.vue | 2 +- packages/vue-vuetify/src/util/composition.ts | 4 +-- packages/vue-vuetify/src/util/validator.ts | 3 +- pnpm-lock.yaml | 17 +++++----- 13 files changed, 53 insertions(+), 50 deletions(-) delete mode 100644 packages/vue-vuetify/example/index.bundled.html diff --git a/packages/angular-material/package.json b/packages/angular-material/package.json index 5e7841859..c99131690 100644 --- a/packages/angular-material/package.json +++ b/packages/angular-material/package.json @@ -70,7 +70,7 @@ "@angular/router": "^17.0.0 || ^18.0.0", "@jsonforms/angular": "3.4.0-alpha.2", "@jsonforms/core": "3.4.0-alpha.2", - "dayjs": "^1.11.7", + "dayjs": "^1.11.10", "rxjs": "^6.6.0 || ^7.4.0" }, "dependencies": { diff --git a/packages/core/src/mappers/renderer.ts b/packages/core/src/mappers/renderer.ts index a3ba1a034..2a80de8e6 100644 --- a/packages/core/src/mappers/renderer.ts +++ b/packages/core/src/mappers/renderer.ts @@ -1249,6 +1249,7 @@ export const mapStateToLabelProps = ( config: getConfig(state), renderers: props.renderers || getRenderers(state), cells: props.cells || getCells(state), + uischema, }; }; diff --git a/packages/core/src/util/schema.ts b/packages/core/src/util/schema.ts index 26161b588..72be3dd7e 100644 --- a/packages/core/src/util/schema.ts +++ b/packages/core/src/util/schema.ts @@ -26,16 +26,27 @@ import find from 'lodash/find'; import type { JsonSchema } from '../models'; -export const getFirstPrimitiveProp = (schema: any) => { - if (schema.properties) { - return find(Object.keys(schema.properties), (propName) => { - const prop = schema.properties[propName]; - return ( - prop.type === 'string' || - prop.type === 'number' || - prop.type === 'integer' - ); - }); +export const getFirstPrimitiveProp = (schema: unknown) => { + if ( + schema && + typeof schema === 'object' && + 'properties' in schema && + schema.properties + ) { + return find( + Object.keys(schema.properties), + (propName: keyof typeof schema.properties) => { + const prop: unknown = schema.properties[propName]; + return ( + prop && + typeof prop === 'object' && + 'type' in prop && + (prop.type === 'string' || + prop.type === 'number' || + prop.type === 'integer') + ); + } + ); } return undefined; }; diff --git a/packages/material-renderers/package.json b/packages/material-renderers/package.json index 626210e29..f60af769b 100644 --- a/packages/material-renderers/package.json +++ b/packages/material-renderers/package.json @@ -79,7 +79,7 @@ ] }, "dependencies": { - "@date-io/dayjs": "1.3.13", + "@date-io/dayjs": "^3.0.0", "dayjs": "1.10.7", "lodash": "^4.17.21" }, diff --git a/packages/vue-vuetify/dev/App.vue b/packages/vue-vuetify/dev/App.vue index e3434f232..eab6fa09b 100644 --- a/packages/vue-vuetify/dev/App.vue +++ b/packages/vue-vuetify/dev/App.vue @@ -36,10 +36,12 @@ const theme = computed(() => { - - - - + + + + + + diff --git a/packages/vue-vuetify/dev/components/ExampleDrawer.vue b/packages/vue-vuetify/dev/components/ExampleDrawer.vue index 6c7378a1e..c662f1281 100644 --- a/packages/vue-vuetify/dev/components/ExampleDrawer.vue +++ b/packages/vue-vuetify/dev/components/ExampleDrawer.vue @@ -4,6 +4,10 @@ import examples from '../examples'; import { useAppStore } from '../store'; const appStore = useAppStore(); + +const handleExampleClick = (exampleName: string) => { + appStore.exampleName = exampleName; +};