-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* try-catch around trigger grouping expressions (#5017) Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> * chore: Updated installOneAuth script to target correct version. (#5020) * Updated installOneAuth script to target correct version. * Better refactor * feat: adaptive expression functions menu (#5015) * expressions menu * Fixing aligment of menu * PR comments Co-authored-by: Soroush <hatpick@gmail.com> * fix: Correct handling of focus for Intellisense fields (#5039) * fix * Improved handling of focus when leveraging an Intellisense suggestion * comments on wrong lines * feat: azure publish with orchestrator (#5011) * refactor the luis build in azure publish * update the orchestrator path * update the cleanup * fix typo * catch the build error * remove qna endpoint * remove console * add qnaconfig Co-authored-by: Geoff Cox (Microsoft) <gcox@microsoft.com> Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> Co-authored-by: Tony Anziano <tonyanziano5@gmail.com> Co-authored-by: LouisEugeneMSFT <66701106+LouisEugeneMSFT@users.noreply.github.com> Co-authored-by: Soroush <hatpick@gmail.com> Co-authored-by: leileizhang <leilzh@microsoft.com>
- Loading branch information
1 parent
0141eaf
commit 2dcddce
Showing
26 changed files
with
585 additions
and
658 deletions.
There are no files selected for viewing
This file contains 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 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
File renamed without changes.
62 changes: 62 additions & 0 deletions
62
Composer/packages/adaptive-form/src/components/expressions/ExpressionsListMenu.tsx
This file contains 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,62 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { ContextualMenu, DirectionalHint } from 'office-ui-fabric-react/lib/ContextualMenu'; | ||
import React, { useCallback, useMemo } from 'react'; | ||
import { builtInFunctionsGrouping, getBuiltInFunctionInsertText } from '@bfc/built-in-functions'; | ||
|
||
import { expressionGroupingsToMenuItems } from './utils/expressionsListMenuUtils'; | ||
|
||
const componentMaxHeight = 400; | ||
|
||
type ExpressionsListMenuProps = { | ||
onExpressionSelected: (expression: string) => void; | ||
onMenuMount: (menuContainerElms: HTMLDivElement[]) => void; | ||
}; | ||
export const ExpressionsListMenu = (props: ExpressionsListMenuProps) => { | ||
const { onExpressionSelected, onMenuMount } = props; | ||
|
||
const containerRef = React.createRef<HTMLDivElement>(); | ||
|
||
const onExpressionKeySelected = useCallback( | ||
(key) => { | ||
const insertText = getBuiltInFunctionInsertText(key); | ||
onExpressionSelected('= ' + insertText); | ||
}, | ||
[onExpressionSelected] | ||
); | ||
|
||
const onLayerMounted = useCallback(() => { | ||
const elms = document.querySelectorAll<HTMLDivElement>('.ms-ContextualMenu-Callout'); | ||
onMenuMount(Array.prototype.slice.call(elms)); | ||
}, [onMenuMount]); | ||
|
||
const menuItems = useMemo( | ||
() => | ||
expressionGroupingsToMenuItems( | ||
builtInFunctionsGrouping, | ||
onExpressionKeySelected, | ||
onLayerMounted, | ||
componentMaxHeight | ||
), | ||
[onExpressionKeySelected, onLayerMounted] | ||
); | ||
|
||
return ( | ||
<div ref={containerRef}> | ||
<ContextualMenu | ||
calloutProps={{ | ||
onLayerMounted: onLayerMounted, | ||
}} | ||
directionalHint={DirectionalHint.bottomLeftEdge} | ||
hidden={false} | ||
items={menuItems} | ||
shouldFocusOnMount={false} | ||
styles={{ | ||
container: { maxHeight: componentMaxHeight }, | ||
}} | ||
target={containerRef} | ||
/> | ||
</div> | ||
); | ||
}; |
48 changes: 48 additions & 0 deletions
48
Composer/packages/adaptive-form/src/components/expressions/utils/expressionsListMenuUtils.ts
This file contains 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,48 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { ContextualMenuItemType, IContextualMenuItem } from 'office-ui-fabric-react/lib/ContextualMenu'; | ||
|
||
type ExpressionGroupingType = { | ||
key: string; | ||
name: string; | ||
children: string[]; | ||
}; | ||
|
||
export const expressionGroupingsToMenuItems = ( | ||
expressionGroupings: ExpressionGroupingType[], | ||
menuItemSelectedHandler: (key: string) => void, | ||
onLayerMounted: () => void, | ||
maxHeight?: number | ||
): IContextualMenuItem[] => { | ||
const menuItems: IContextualMenuItem[] = | ||
expressionGroupings?.map((grouping: ExpressionGroupingType) => { | ||
return { | ||
key: grouping.key, | ||
text: grouping.name, | ||
target: '_blank', | ||
subMenuProps: { | ||
calloutProps: { onLayerMounted: onLayerMounted }, | ||
items: grouping.children.map((key: string) => { | ||
return { | ||
key: key, | ||
text: key, | ||
onClick: () => menuItemSelectedHandler(key), | ||
}; | ||
}), | ||
styles: { container: { maxHeight } }, | ||
}, | ||
}; | ||
}) || []; | ||
|
||
const header = { | ||
key: 'header', | ||
itemType: ContextualMenuItemType.Header, | ||
text: 'Pre-built functions', | ||
itemProps: { lang: 'en-us' }, | ||
}; | ||
|
||
menuItems.unshift(header); | ||
|
||
return menuItems; | ||
}; |
This file contains 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 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 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 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 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 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 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 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
Oops, something went wrong.