import { ConfigProvider, Segmented, Space, theme as antdTheme } from 'ant-design-vue'; import type { MutableTheme } from '../interface'; import type { PropType, CSSProperties } from 'vue'; import { defineComponent, toRefs, ref, computed } from 'vue'; import ComponentDemoGroup from '../component-panel/ComponentDemoGroup'; import { useInjectLocaleContext } from '../locale'; import { Error, Primary, Success, Warning } from '../overviews'; export type ComponentDemoProProps = { selectedTokens?: string[]; theme: MutableTheme; components: Record; activeComponents?: string[]; componentDrawer?: boolean; showAll?: boolean; }; const ComponentDemoPro = defineComponent({ name: 'ComponentDemoPro', inheritAttrs: false, props: { selectedTokens: { type: Array as PropType }, theme: { type: Object as PropType }, components: { type: Object as PropType> }, activeComponents: { type: Array as PropType }, componentDrawer: { type: Boolean }, showAll: { type: Boolean }, }, setup(props, { attrs }) { const { selectedTokens, theme, components, activeComponents, componentDrawer, showAll } = toRefs(props); const mode = ref<'overview' | 'component'>('overview'); const { token } = antdTheme.useToken(); const locale = useInjectLocaleContext(); const overviewDemo = computed(() => { if (showAll.value) { return ( ); } if (selectedTokens.value?.includes('colorError')) { return ; } if (selectedTokens.value?.includes('colorSuccess')) { return ; } if (selectedTokens.value?.includes('colorWarning')) { return ; } return ; }); return () => { return (
(mode.value = val as any)} style={{ margin: '12px 0 0 12px' }} /> {mode.value === 'overview' ? (
{overviewDemo.value}
) : ( )}
); }; }, }); export default defineComponent({ name: 'ComponentDemoProProvider', inheritAttrs: false, props: { selectedTokens: { type: Array as PropType }, theme: { type: Object as PropType }, components: { type: Object as PropType> }, activeComponents: { type: Array as PropType }, componentDrawer: { type: Boolean }, showAll: { type: Boolean }, }, setup(props, { attrs }) { return () => ( ); }, });