@@ -27,14 +27,14 @@ import type { Categorization, Category, LayoutProps } from '@jsonforms/core';
27
27
import { isVisible } from '@jsonforms/core' ;
28
28
import {
29
29
TranslateProps ,
30
+ useJsonForms ,
30
31
withJsonFormsLayoutProps ,
31
32
withTranslateProps ,
32
33
} from '@jsonforms/react' ;
33
34
import { CategorizationList } from './CategorizationList' ;
34
35
import { SingleCategory } from './SingleCategory' ;
35
36
import { withVanillaControlProps } from '../../util' ;
36
37
import type { AjvProps , VanillaRendererProps } from '../../index' ;
37
- import { withAjvProps } from '../../index' ;
38
38
39
39
export interface CategorizationState {
40
40
selectedCategory : Category ;
@@ -55,14 +55,14 @@ export const CategorizationRenderer = ({
55
55
visible,
56
56
getStyleAsClassName,
57
57
onChange,
58
- ajv,
59
58
} : LayoutProps &
60
59
VanillaRendererProps &
61
60
TranslateProps &
62
61
CategorizationProps &
63
62
AjvProps ) => {
63
+ const ajv = useJsonForms ( ) . core . ajv ;
64
64
const categorization = uischema as Categorization ;
65
- const categories = useMemo (
65
+ const filteredCategories = useMemo (
66
66
( ) =>
67
67
categorization . elements . filter ( ( category : Category ) =>
68
68
isVisible ( category , data , undefined , ajv )
@@ -101,8 +101,8 @@ export const CategorizationRenderer = ({
101
101
>
102
102
< div className = { masterClassNames } >
103
103
< CategorizationList
104
- categorization = { categorization }
105
- selectedCategory = { categories [ safeCategory ] }
104
+ filteredCategories = { filteredCategories }
105
+ selectedCategory = { filteredCategories [ safeCategory ] }
106
106
depth = { 0 }
107
107
onSelect = { onCategorySelected }
108
108
subcategoriesClassName = { subcategoriesClassName }
@@ -112,7 +112,7 @@ export const CategorizationRenderer = ({
112
112
</ div >
113
113
< div className = { detailClassNames } >
114
114
< SingleCategory
115
- category = { categories [ safeCategory ] }
115
+ category = { filteredCategories [ safeCategory ] }
116
116
schema = { schema }
117
117
path = { path }
118
118
key = { safeCategory }
@@ -122,8 +122,6 @@ export const CategorizationRenderer = ({
122
122
) ;
123
123
} ;
124
124
125
- export default withAjvProps (
126
- withVanillaControlProps (
127
- withTranslateProps ( withJsonFormsLayoutProps ( CategorizationRenderer ) )
128
- )
125
+ export default withVanillaControlProps (
126
+ withTranslateProps ( withJsonFormsLayoutProps ( CategorizationRenderer ) )
129
127
) ;
0 commit comments