This commit is contained in:
Daniil Senkiv 2019-12-27 13:41:46 +03:00
commit fe044697d3
14 changed files with 75 additions and 37 deletions

View File

@ -51,15 +51,15 @@ const MainContainer = styled.div`
.search_container {
margin-top: 32px;
display: none;
}
.selected-members_container {
margin-top: 16px;
margin-top: 32px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-row-gap: 8px;
grid-column-gap: 16px;
margin-top: 16px;
}
.buttons_container {

View File

@ -1384,7 +1384,8 @@ namespace ASC.Employee.Core.Controllers
PermissionContext.DemandPermissions(new UserSecurityProvider(user.ID), Constants.Action_EditUser);
if (contacts == null) return;
user.Contacts = contacts.Select(r => $"{r.Type}|{r.Value}").Aggregate((a, b) => $"{a}|{b}");
var values = contacts.Where(r => !string.IsNullOrEmpty(r.Value)).Select(r => $"{r.Type}|{r.Value}");
user.Contacts = string.Join('|', values);
}
private void DeleteContacts(IEnumerable<Contact> contacts, UserInfo user)

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-common",
"version": "1.0.29",
"version": "1.0.30",
"description": "Ascensio System SIA common components and solutions library",
"license": "AGPL-3.0",
"files": [

View File

@ -87,6 +87,7 @@ class ProfileActions extends React.PureComponent {
withArrow
directionX="right"
open={this.state.opened}
clickOutsideAction={this.onAvatarClick}
>
<DropDownProfileItem
avatarRole={this.getUserRole(this.state.user)}

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-components",
"version": "1.0.279",
"version": "1.0.282",
"description": "Ascensio System SIA component library",
"license": "AGPL-3.0",
"main": "dist/asc-web-components.js",

View File

@ -49,7 +49,7 @@ class ComboBox extends React.Component {
comboBoxClick = (e) => {
if (this.props.isDisabled || e && e.target.closest('.optionalBlock')) return;
this.toggle(!this.state.isOpen);
this.props.toggleAction && this.props.toggleAction(e);
this.props.toggleAction && this.props.toggleAction(e, this.state.isOpen);
};
optionClick = (option) => {

View File

@ -58,7 +58,8 @@ const StyledComboButton = styled.div`
`}
}
.combo-button-label{
margin-right: 8px;
margin-right: ${props => props.noBorder ? `4px` : `8px`};
color: ${props => props.isDisabled ? '#D0D5DA' : '#333333'};
max-width: 175px;
${props => props.noBorder && `
line-height: 15px;
@ -66,7 +67,7 @@ const StyledComboButton = styled.div`
`}
}
.combo-button-label:hover{
${props => props.noBorder && `
${props => props.noBorder && !props.isDisabled && `
border-bottom: 1px dashed;
`}
}
@ -149,6 +150,7 @@ class ComboButton extends React.Component {
truncate={true}
fontWeight={600}
className="combo-button-label"
color={boxIconColor + ' !important'}
>
{selectedOption.label}
</Text>

View File

@ -116,7 +116,11 @@ class ContextMenuButton extends React.Component {
onMouseOver={onMouseOver}
onMouseOut={onMouseOut}
/>
<DropDown directionX={directionX} open={isOpen}>
<DropDown
directionX={directionX}
open={isOpen}
clickOutsideAction={this.onIconButtonClick}
>
{
this.state.data.map((item, index) =>
(item && (item.label || item.icon || item.key)) && <DropDownItem {...item} key={item.key || index} onClick={this.onDropDownItemClick.bind(this, item)}

View File

@ -69,7 +69,7 @@ const StyledDropdownItem = styled.div`
padding: 0px 16px;
border: 0.5px solid #ECEEF1;
cursor: default;
margin: 6px 16px 4px;
margin: 6px 16px 6px;
line-height: 1px;
height: 1px;
width: calc(100% - 32px);

View File

@ -34,4 +34,4 @@ When using component, it should be noted that parent must have CSS property _pos
| `open` | `bool` | - | - | `false` | Tells when the dropdown should be opened |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `withArrow` | `bool` | - | - | `false` | It is used if it is necessary to display blue protruding angle as when viewing profile |
| `withBackdrop` | `bool` | - | - | `false` | Used to display backdrop |
| `withBackdrop` | `bool` | - | - | `true` | Used to display backdrop |

View File

@ -170,7 +170,7 @@ DropDown.defaultProps = {
directionX: 'left',
directionY: 'bottom',
withArrow: false,
withBackdrop: false
withBackdrop: true
};
export default DropDown

View File

@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
const StyledCloseButton = styled.div`
margin-left: 7px;
margin-top: -2px;
margin-top: -1px;
`;
const CloseButton = props => {
//console.log("CloseButton render");

View File

@ -1,5 +1,5 @@
import React from 'react';
import styled from 'styled-components';
import styled, {css} from 'styled-components';
import FilterButton from './filter-button';
import HideFilter from './hide-filter';
import ComboBox from '../combobox';
@ -17,12 +17,12 @@ const StyledFilterItem = styled.div`
margin-bottom: ${props => props.block ? '8px' : '0'};
position: relative;
height: 100%;
padding: 4px 22px 2px 7px;
margin-right: 2px;
border: 1px solid #ECEEF1;
border-radius: 3px;
background-color: #F8F9F9;
padding-right: 22px;
font-weight: 600;
font-size: 13px;
line-height: 15px;
@ -33,6 +33,20 @@ const StyledFilterItem = styled.div`
margin-bottom: 0;
}
`;
const StyledFilterItemContent = styled.div`
display: flex;
padding: 5px 0 2px 7px;
${props =>
!props.isDisabled &&
css`
&:active{
background: #ECEEF1;
}
`}
`;
const StyledCloseButtonBlock = styled.div`
display: flex;
cursor: ${props =>
@ -43,7 +57,18 @@ const StyledCloseButtonBlock = styled.div`
width: 25px;
border-left: 1px solid #ECEEF1;
right: 0;
top: 1px;
top: 0;
background-color: #F8F9F9;
${props =>
!props.isDisabled &&
css`
&:active{
background: #ECEEF1;
svg path:first-child {
fill: #333;
}
}
`}
`;
const StyledComboBox = styled(ComboBox)`
display: inline-block;
@ -51,6 +76,7 @@ const StyledComboBox = styled(ComboBox)`
max-width: 185px;
cursor: pointer;
vertical-align: middle;
margin-top: -1px;
> div:first-child{
width: auto;
padding-left: 4px;
@ -87,27 +113,30 @@ class FilterItem extends React.Component {
render() {
return (
<StyledFilterItem key={this.state.id} id={this.state.id} block={this.props.block} >
{this.props.groupLabel}:
{this.props.groupItems.length > 1 ?
<StyledComboBox
options={this.props.groupItems}
isDisabled={this.props.isDisabled}
onSelect={this.onSelect}
selectedOption={{
key: this.state.id,
label: this.props.label
}}
size='content'
scaled={false}
noBorder={true}
opened={this.props.opened}
directionX='left'
></StyledComboBox>
: <StyledFilterName>{this.props.label}</StyledFilterName>
}
<StyledFilterItem key={this.state.id} id={this.state.id} block={this.props.block} opened={this.props.opened} >
<StyledFilterItemContent isDisabled={this.props.isDisabled}>
{this.props.groupLabel}:
{this.props.groupItems.length > 1 ?
<StyledComboBox
options={this.props.groupItems}
isDisabled={this.props.isDisabled}
onSelect={this.onSelect}
selectedOption={{
key: this.state.id,
label: this.props.label
}}
size='content'
scaled={false}
noBorder={true}
opened={this.props.opened}
directionX='left'
></StyledComboBox>
: <StyledFilterName>{this.props.label}</StyledFilterName>
}
</StyledFilterItemContent>
<StyledCloseButtonBlock onClick={this.onClick}>
<StyledCloseButtonBlock onClick={this.onClick} isDisabled={this.props.isDisabled} isClickable={true}>
<CloseButton
isDisabled={this.props.isDisabled}
onClick={this.onClick}

View File

@ -111,6 +111,7 @@ class HideFilter extends React.Component {
className="drop-down"
manualY="8px"
open={this.state.popoverOpen}
clickOutsideAction={this.handleClick}
>
{this.props.children}
</DropDown>