Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: RepeatDialog not shown #1835

Merged
merged 3 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '?'}}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ const renderWidget = (inputData, schema: UIWidget, contextProps = {}): JSX.Eleme
return <Widget data={inputData} {...contextProps} {...props} />;
};

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);
};