This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 375
chore: migrate SendActivity, BeginDialog, ReplaceDialog to uischema #1840
Merged
a-b-r-o-w-n
merged 18 commits into
microsoft:master
from
yeze322:visual/schema-driven--wave2.SendActivity
Jan 13, 2020
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e59d7d8
render fallback node
yeze322 3f5eeda
fix the problem in a more schema-driven way
yeze322 b40b7ee
revert unnecessary changes
yeze322 def5d0e
extend builtin props: id, data, onEvent
yeze322 132aed2
migrate widget ActionCard to new base props
yeze322 aa3247e
retire DefaultRenderer
yeze322 9da140f
Merge branch 'master' into visual/schema-driven--wave1.chore
yeze322 9144e6e
make ActivityRenderer a widget
yeze322 ff186fa
make 'icon' customizable
yeze322 b161c15
update sdk demp
yeze322 f66e21f
register 'SendActivity' in uischema
yeze322 55d5ac6
drive ReplaceDialog, BeginDialog
yeze322 a000191
Merge branch 'master' into visual/schema-driven--wave2.SendActivity
yeze322 96e196c
Merge branch 'schema/BeginDialog' into visual/schema-driven--wave2.Se…
yeze322 b439b52
fix lint
yeze322 76341ea
render BeginDialog, ReplaceDialog with UISchemaRenderer
yeze322 c8dcfc0
leverage fabric <Link /> as dialog ref
yeze322 8733e6a
Merge branch 'master' into visual/schema-driven--wave2.SendActivity
yeze322 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
Composer/packages/extensions/visual-designer/src/components/nodes/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
Composer/packages/extensions/visual-designer/src/components/nodes/steps/ActivityRenderer.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Composer/packages/extensions/visual-designer/src/widgets/ActivityRenderer.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import React from 'react'; | ||
| import { generateSDKTitle } from '@bfc/shared'; | ||
| import get from 'lodash/get'; | ||
|
|
||
| import { NodeEventTypes } from '../constants/NodeEventTypes'; | ||
| import { ElementIcon } from '../utils/obiPropertyResolver'; | ||
| import { NodeMenu } from '../components/menus/NodeMenu'; | ||
| import { FormCard } from '../components/nodes/templates/FormCard'; | ||
| import { useLgTemplate } from '../utils/hooks'; | ||
| import { WidgetContainerProps } from '../schema/uischema.types'; | ||
| import { ObiColors } from '../constants/ElementColors'; | ||
|
|
||
| export interface ActivityRenderer extends WidgetContainerProps { | ||
| /** indicates which field contains lg activity. ('activity', 'prompt', 'invalidPropmt'...) */ | ||
| field: string; | ||
| icon: ElementIcon; | ||
| colors?: { | ||
| theme: string; | ||
| icon: string; | ||
| }; | ||
| } | ||
|
|
||
| const DefaultThemeColor = { | ||
| theme: ObiColors.BlueMagenta20, | ||
| icon: ObiColors.BlueMagenta30, | ||
| }; | ||
|
|
||
| export const ActivityRenderer: React.FC<ActivityRenderer> = ({ | ||
| id, | ||
| data, | ||
| onEvent, | ||
| field, | ||
| icon = ElementIcon.MessageBot, | ||
| colors = DefaultThemeColor, | ||
| }) => { | ||
| const designerId = get(data, '$designer.id'); | ||
| const activityTemplate = get(data, field, ''); | ||
|
|
||
| const templateText = useLgTemplate(activityTemplate, designerId); | ||
| const nodeColors = { themeColor: colors.theme, iconColor: colors.icon }; | ||
|
|
||
| return ( | ||
| <FormCard | ||
| header={generateSDKTitle(data)} | ||
| label={templateText} | ||
| icon={icon} | ||
| corner={<NodeMenu id={id} onEvent={onEvent} />} | ||
| nodeColors={nodeColors} | ||
| onClick={() => { | ||
| onEvent(NodeEventTypes.Focus, { id }); | ||
| }} | ||
| /> | ||
| ); | ||
| }; |
63 changes: 63 additions & 0 deletions
63
Composer/packages/extensions/visual-designer/src/widgets/DialogRefCard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| /** @jsx jsx */ | ||
| import { jsx } from '@emotion/core'; | ||
| import { generateSDKTitle } from '@bfc/shared'; | ||
| import get from 'lodash/get'; | ||
|
|
||
| import { FormCard } from '../components/nodes/templates/FormCard'; | ||
| import { WidgetContainerProps, WidgetComponent } from '../schema/uischema.types'; | ||
| import { ObiColors } from '../constants/ElementColors'; | ||
| import { NodeEventTypes } from '../constants/NodeEventTypes'; | ||
| import { NodeMenu } from '../components/menus/NodeMenu'; | ||
|
|
||
| export interface DialogRefCardProps extends WidgetContainerProps { | ||
| dialog: string | object; | ||
| getRefContent?: (dialogRef: JSX.Element) => JSX.Element; | ||
| colors?: { | ||
| theme: string; | ||
| icon: string; | ||
| }; | ||
| } | ||
|
|
||
| const DefaultCardColor = { | ||
| theme: ObiColors.AzureGray3, | ||
| icon: ObiColors.AzureGray2, | ||
| }; | ||
|
|
||
| export const DialogRefCard: WidgetComponent<DialogRefCardProps> = ({ | ||
| id, | ||
| data, | ||
| onEvent, | ||
| dialog, | ||
| getRefContent, | ||
| colors = DefaultCardColor, | ||
| }) => { | ||
| const header = generateSDKTitle(data); | ||
| const nodeColors = { themeColor: colors.theme, iconColor: colors.icon }; | ||
| const calleeDialog = typeof dialog === 'object' ? get(dialog, '$ref') : dialog; | ||
| const dialogRef = ( | ||
| <span | ||
| css={{ | ||
| cursor: 'pointer', | ||
| color: 'blue', | ||
| }} | ||
| onClick={e => { | ||
| e.stopPropagation(); | ||
| onEvent(NodeEventTypes.OpenDialog, { caller: id, callee: calleeDialog }); | ||
| }} | ||
| > | ||
| {calleeDialog} | ||
| </span> | ||
| ); | ||
| return ( | ||
| <FormCard | ||
| header={header} | ||
| corner={<NodeMenu id={id} onEvent={onEvent} />} | ||
| label={typeof getRefContent === 'function' ? getRefContent(dialogRef) : dialogRef} | ||
| nodeColors={nodeColors} | ||
| onClick={() => onEvent(NodeEventTypes.Focus, { id })} | ||
| /> | ||
| ); | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.