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

feat: repaint ui for setProperties in visual editor #2017

Merged
merged 26 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e401f62
elements interface
alanlong9278 Feb 19, 2020
874417f
styled component
alanlong9278 Feb 21, 2020
85c04ce
Merge branch 'master' into julong/nodeDesign
alanlong9278 Feb 21, 2020
1de0d13
use styledComponent in visual editor
alanlong9278 Feb 21, 2020
8136288
refactor
alanlong9278 Feb 21, 2020
e662100
Merge branch 'master' into julong/nodeDesign
alanlong9278 Feb 22, 2020
e571084
add styled package
alanlong9278 Feb 22, 2020
cd45b6c
Merge branch 'julong/nodeDesign' of https://github.com/microsoft/BotF…
alanlong9278 Feb 22, 2020
cd3a822
module name
alanlong9278 Feb 22, 2020
0375ba5
revert uischema & refactor itemOverview component
alanlong9278 Feb 24, 2020
c06b9e6
ui adjust
alanlong9278 Feb 24, 2020
337e8f3
rename & delete needless code
alanlong9278 Feb 24, 2020
5221a3f
Merge branch 'master' into julong/nodeDesign
a-b-r-o-w-n Feb 25, 2020
1c4b956
Merge branch 'master' into julong/nodeDesign
alanlong9278 Feb 26, 2020
bbc3cc9
Merge branch 'julong/nodeDesign' of https://github.com/microsoft/BotF…
alanlong9278 Feb 26, 2020
291b44f
truncate text
alanlong9278 Feb 26, 2020
ea45495
Merge branch 'master' into julong/nodeDesign
alanlong9278 Feb 27, 2020
4c4cbf6
copy formcard to listoverviewcard for choiceinput and setProperties
alanlong9278 Feb 27, 2020
e907af9
refactor code
alanlong9278 Feb 27, 2020
2c96f84
Merge branch 'master' into julong/nodeDesign
alanlong9278 Feb 27, 2020
da2dbd3
Merge branch 'master' into julong/nodeDesign
alanlong9278 Feb 28, 2020
b744555
delete listOverviewWidget
alanlong9278 Feb 28, 2020
349cd6e
css
alanlong9278 Feb 28, 2020
b05c560
fix some bug
alanlong9278 Feb 29, 2020
582bb49
Merge branch 'master' into julong/nodeDesign
alanlong9278 Mar 2, 2020
0535f83
Merge branch 'master' into julong/nodeDesign
alanlong9278 Mar 3, 2020
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

This file was deleted.

3 changes: 2 additions & 1 deletion Composer/packages/extensions/visual-designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},
"dependencies": {
"@bfc/shared": "*",
"@emotion/core": "^10.0.7",
"@emotion/core": "^10.0.27",
"@emotion/styled": "^10.0.27",
"@types/react": "16.9.0",
"classnames": "^2.2.6",
"create-react-class": "^15.6.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import React, { FC, ComponentClass } from 'react';

import { MultiLineDiv } from '../elements/styledComponents';

export interface ListOverviewProps {
items: string[];
ItemRender: FC<any> | ComponentClass<any, any>;
maxCount: number;
styles?: Record<string, any>;
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
}
export const ListOverview: React.FC<ListOverviewProps> = ({ items, ItemRender, maxCount, styles }) => {
return (
<>
{items.map((value, index) => {
if (index < 3) {
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
return (
<ItemRender key={index} title={typeof value === 'string' ? value : ''}>
{value}
</ItemRender>
);
}
})}
{items.length > maxCount ? (
<MultiLineDiv
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
data-testid="hasMore"
style={{
...styles,
textAlign: 'center',
}}
>
{`${items.length - 3} more`}
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
</MultiLineDiv>
) : null}
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { css } from '@emotion/core';
import styled from '@emotion/styled';
import { Link } from 'office-ui-fabric-react/lib/Link';

import { ObiColors } from '../../constants/ElementColors';
import { ChoiceInputSize } from '../../constants/ElementSizes';

import { ElementProps, MultiLineDivProps, ElementComponent } from './styledComponents.types';

const dynamicStyle = props =>
css`
color: ${props.color || ObiColors.Black};
`;

export const LinkBtn = styled(Link)(props => ({
color: props.color || ObiColors.AzureBlue,
}));

export const Span = styled.span`
${dynamicStyle}
`;

export const BorderedDiv: ElementComponent<ElementProps> = styled.div<ElementProps>(props => ({
color: props.color || ObiColors.Black,
width: ChoiceInputSize.width,
height: ChoiceInputSize.height,
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
padding: '2px 0 0 8px',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
fontFamily: 'Segoe UI',
fontSize: '12px',
lineHeight: '14px',
border: '1px solid #C4C4C4',
boxSizing: 'border-box',
}));

export const MultiLineDiv = styled.div<MultiLineDivProps>(props => ({
color: props.color || ObiColors.Black,
fontSize: '12px',
height: `${(props.lineNum || 1) * 19}px`,
lineHeight: '19px',
fontFamily: 'Segoe UI',
overflow: 'hidden',
textOverflow: 'ellipsis',
wordBreak: 'break-word',
display: '-webkit-box',
'-webkit-line-clamp': `${props.lineNum || 1}`,
'-webkit-box-orient': 'vertical',
}));

export const SingleLineDiv = styled.div<ElementProps>(props => ({
color: props.color || ObiColors.Black,
fontSize: '12px',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
lineHeight: '19px',
height: '19px',
fontFamily: 'Segoe UI',
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { DetailedHTMLProps, HTMLAttributes, ComponentClass, FC } from 'react';

export type ElementProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
export interface MultiLineDivProps extends ElementProps {
lineNum?: number;
}
export type ElementComponent<T extends ElementProps> = FC<T> | ComponentClass<T, any>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/** @jsx jsx */
import { jsx } from '@emotion/core';
import { FunctionComponent } from 'react';

import { InitNodeSize } from '../../../constants/ElementSizes';
import { ElementIcon } from '../../../utils/obiPropertyResolver';
import { Icon } from '../../decorations/icon';
import { SingleLineDiv } from '../../elements/styledComponents';

const boxWidth = InitNodeSize.width;
const boxHeight = InitNodeSize.height;
const headerHeight = InitNodeSize.height / 2;
const contentHeight = boxHeight - headerHeight;

const containerStyle = {
width: boxWidth,
minHeight: boxHeight,
fontSize: '12px',
cursor: 'pointer',
overflow: 'hidden',
backgroundColor: 'white',
borderRadius: '2px 2px 0 0',
boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.1)',
};

interface NodeProps {
header: string;
corner?: any;
label?: any;
icon?: string;
iconSize?: number;
styles?: object;
nodeColors: { [key: string]: any };
onClick?: () => void;
children?: any;
}
export const ListOverviewCard: FunctionComponent<NodeProps> = ({
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
alanlong9278 marked this conversation as resolved.
Show resolved Hide resolved
header,
corner,
label,
icon,
iconSize,
nodeColors,
onClick,
children = null,
styles = {},
}) => {
const { themeColor, iconColor } = nodeColors;
return (
<div
className="card"
data-testid="FormCard"
css={[containerStyle, { ...styles }]}
onClick={e => {
if (typeof onClick === 'function') {
e.stopPropagation();
onClick();
}
}}
>
<div
className="card__header"
css={{
width: '100%',
height: `${headerHeight}px`,
backgroundColor: themeColor,
fontFamily: 'Segoe UI',
fontSize: '12px',
lineHeight: '14px',
color: 'black',
}}
>
<div
css={{
padding: '4px 8px',
fontSize: '12px',
fontFamily: 'Segoe UI',
lineHeight: '14px',
overflow: 'hidden',
textOverflow: 'ellipsis',
width: 'calc(100% - 40px)',
whiteSpace: 'pre',
}}
>
{header}
</div>
<div css={{ position: 'absolute', top: 4, right: 0 }}>{corner}</div>
</div>
<div
className="card__content"
css={{
width: '100%',
minHeight: contentHeight,
display: 'inline-block',
}}
>
{label && (
<div
css={{
fontWeight: 400,
paddingLeft: '5px',
margin: '3px 5px',
fontSize: '14px',
lineHeight: '19px',
display: 'flex',
alignItems: 'center',
}}
>
{icon && icon !== ElementIcon.None && (
<div
css={{
width: 16,
height: 16,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
marginRight: '5px',
}}
>
<Icon icon={icon} color={iconColor} size={iconSize || 16} />
</div>
)}
<SingleLineDiv title={typeof label === 'string' ? label : ''}>{label}</SingleLineDiv>
</div>
)}
{children}
</div>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export const ChoiceInputSize = {
export const ChoiceInputMarginTop = 8;
export const ChoiceInputMarginBottom = 10;

export const PropertyAssignmentSize = {
width: 155,
height: 16,
};

export const AssignmentMarginTop = 6;
export const AssignmentMarginBottom = 8;

export const EventNodeSize = {
width: 240,
height: 125,
Expand Down
Loading