diff --git a/Composer/packages/extensions/visual-designer/src/schema/uischema.ts b/Composer/packages/extensions/visual-designer/src/schema/uischema.ts index 49761bc551..620105afaf 100644 --- a/Composer/packages/extensions/visual-designer/src/schema/uischema.ts +++ b/Composer/packages/extensions/visual-designer/src/schema/uischema.ts @@ -8,6 +8,9 @@ import { ActionCard } from '../widgets/ActionCard'; import { UISchema } from './uischema.types'; export const uiSchema: UISchema = { + default: { + 'ui:widget': ActionCard, + }, [SDKTypes.EditArray]: { 'ui:widget': ActionCard, content: data => `${data.changeType} {${data.itemsProperty || '?'}}`, diff --git a/Composer/packages/extensions/visual-designer/src/schema/uischema.types.ts b/Composer/packages/extensions/visual-designer/src/schema/uischema.types.ts index 9c4262e02b..465d09b1a2 100644 --- a/Composer/packages/extensions/visual-designer/src/schema/uischema.types.ts +++ b/Composer/packages/extensions/visual-designer/src/schema/uischema.types.ts @@ -4,9 +4,13 @@ import { FC, ComponentClass } from 'react'; import { BaseSchema, SDKTypes } from '@bfc/shared'; +export enum UISchemaBuiltinKeys { + default = 'default', +} + /** schema */ export type UISchema = { - [key in SDKTypes]?: UIWidget; + [key in SDKTypes | UISchemaBuiltinKeys]?: UIWidget; }; /** widget */ diff --git a/Composer/packages/extensions/visual-designer/src/schema/uischemaRenderer.tsx b/Composer/packages/extensions/visual-designer/src/schema/uischemaRenderer.tsx index 24499b4954..d7d5fa73f4 100644 --- a/Composer/packages/extensions/visual-designer/src/schema/uischemaRenderer.tsx +++ b/Composer/packages/extensions/visual-designer/src/schema/uischemaRenderer.tsx @@ -40,12 +40,9 @@ const renderWidget = (inputData, schema: UIWidget, contextProps = {}): JSX.Eleme return ; }; -const renderFallbackElement = (data: BaseSchema) => <>; - export const renderSDKType = (data: BaseSchema, context?: { menu: JSX.Element; onClick }): JSX.Element => { const $type = get(data, '$type'); - const schema: UIWidget = get(uiSchema, $type); - if (!schema) return renderFallbackElement(data); + const schema = get(uiSchema, $type, uiSchema.default); return renderWidget(data, schema, context); };