mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 03:10:42 +01:00
docs(ComponentProps): handle ignore in schema
This commit is contained in:
@@ -77,7 +77,7 @@ const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {
|
|||||||
|
|
||||||
<MDC v-if="prop.description" :value="prop.description" class="text-gray-600 dark:text-gray-300 mt-1" />
|
<MDC v-if="prop.description" :value="prop.description" class="text-gray-600 dark:text-gray-300 mt-1" />
|
||||||
|
|
||||||
<ComponentPropsSchema v-if="prop.schema" :prop="prop" />
|
<ComponentPropsSchema v-if="prop.schema" :prop="prop" :ignore="ignore" />
|
||||||
</ProseTd>
|
</ProseTd>
|
||||||
</ProseTr>
|
</ProseTr>
|
||||||
</ProseTbody>
|
</ProseTbody>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { PropertyMeta } from 'vue-component-meta'
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
prop: PropertyMeta
|
prop: PropertyMeta
|
||||||
|
ignore?: string[]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
function getSchemaProps(schema: PropertyMeta['schema']) {
|
function getSchemaProps(schema: PropertyMeta['schema']) {
|
||||||
@@ -11,7 +12,7 @@ function getSchemaProps(schema: PropertyMeta['schema']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (schema.kind === 'object') {
|
if (schema.kind === 'object') {
|
||||||
return Object.values(schema.schema)
|
return Object.values(schema.schema).filter(prop => !props.ignore?.includes(prop.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Array.isArray(schema.schema) ? schema.schema : Object.values(schema.schema)).flatMap(getSchemaProps)
|
return (Array.isArray(schema.schema) ? schema.schema : Object.values(schema.schema)).flatMap(getSchemaProps)
|
||||||
|
|||||||
Reference in New Issue
Block a user