From 09cb9c80bd035800502ab4afc22a741cf7ef330b Mon Sep 17 00:00:00 2001 From: Srinath Narayanan Date: Fri, 30 Jul 2021 12:25:40 +0530 Subject: [PATCH] initial commit for right panel --- .../Controls/SmartUi/SmartUiComponent.tsx | 41 ++++++++++++++----- src/SelfServe/Decorators.tsx | 10 ++++- src/SelfServe/Example/SelfServeExample.tsx | 20 +++++++-- src/SelfServe/SelfServeComponent.tsx | 5 ++- src/SelfServe/SelfServeTypes.ts | 9 ++++ src/SelfServe/SelfServeUtils.tsx | 3 ++ src/SelfServe/SqlX/SqlX.tsx | 12 +++--- 7 files changed, 78 insertions(+), 22 deletions(-) diff --git a/src/Explorer/Controls/SmartUi/SmartUiComponent.tsx b/src/Explorer/Controls/SmartUi/SmartUiComponent.tsx index be6b6fdb1..563c2edb5 100644 --- a/src/Explorer/Controls/SmartUi/SmartUiComponent.tsx +++ b/src/Explorer/Controls/SmartUi/SmartUiComponent.tsx @@ -1,6 +1,7 @@ import { - Dropdown, - IDropdownOption, + DocumentCard, + DocumentCardDetails, + Dropdown, IDropdownOption, IStackTokens, Label, Link, @@ -12,19 +13,19 @@ import { Stack, Text, TextField, - Toggle, + Toggle } from "@fluentui/react"; import { TFunction } from "i18next"; import * as React from "react"; import { ChoiceItem, Description, - DescriptionType, - Info, + DescriptionType, Info, InputType, InputTypeValue, NumberUiType, SmartUiInput, + Style } from "../../../SelfServe/SelfServeTypes"; import { ToolTipLabelComponent } from "../Settings/SettingsSubComponents/ToolTipLabelComponent"; import * as InputUtils from "./InputUtils"; @@ -87,6 +88,7 @@ interface Node { info?: Info; input?: AnyDisplay; children?: Node[]; + style?: Style } export interface SmartUiDescriptor { @@ -194,6 +196,14 @@ export class SmartUiComponent extends React.Component + + {descriptionElement} + + + ) } const messageBarType = description.type === DescriptionType.InfoMessageBar ? MessageBarType.info : MessageBarType.warning; @@ -396,18 +406,29 @@ export class SmartUiComponent extends React.Component - {node.input && this.renderElement(node.input, node.info as Info)} - {node.children && node.children.map((child) =>
{this.renderNode(child)}
)} + {isSectionFloatRight === isNodeFloatRight ? + <> + {node.input && this.renderElement(node.input, node.info as Info)} + + : <> + } + {node.children && node.children.map((child) =>
{this.renderNode(child, isSectionFloatRight)}
)} ); } render(): JSX.Element { - return this.renderNode(this.props.descriptor.root); + return ( + + {this.renderNode(this.props.descriptor.root, false)} + {this.renderNode(this.props.descriptor.root, true)} + + ); } } diff --git a/src/SelfServe/Decorators.tsx b/src/SelfServe/Decorators.tsx index 3d85024a0..1d848c6a8 100644 --- a/src/SelfServe/Decorators.tsx +++ b/src/SelfServe/Decorators.tsx @@ -2,7 +2,7 @@ * @module SelfServe/Decorators */ -import { ChoiceItem, Description, Info, NumberUiType, OnChangeCallback, RefreshParams } from "./SelfServeTypes"; +import { ChoiceItem, Description, Info, NumberUiType, OnChangeCallback, RefreshParams, Style } from "./SelfServeTypes"; import { addPropertyToMap, buildSmartUiDescriptor, DecoratorProperties } from "./SelfServeUtils"; type ValueOf = T[keyof T]; @@ -162,6 +162,14 @@ export const PropertyInfo = (info: (() => Promise) | Info): PropertyDecora return addToMap({ name: "info", value: info }); }; +/** + * Indicates that the UI element corresponding to the property should have an Info bubble. The Info + * bubble is the icon that looks like an "i" which users click on to get more information about the UI element. + */ +export const Styles = (style: (() => Promise