diff --git a/web/ASC.Web.Components/src/components/combobox/index.js b/web/ASC.Web.Components/src/components/combobox/index.js index 4b072e9d6e..faf76bad68 100644 --- a/web/ASC.Web.Components/src/components/combobox/index.js +++ b/web/ASC.Web.Components/src/components/combobox/index.js @@ -1,50 +1,88 @@ import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components'; -import InputBlock from '../input-block' import DropDownItem from '../drop-down-item' import DropDown from '../drop-down' import { Icons } from '../icons' import { handleAnyClick } from '../../utils/event'; const StyledComboBox = styled.div` - * { - ${props => !props.withBorder && `border-color: transparent !important;`} - } + color: ${props => props.isDisabled ? '#D0D5DA' : '#333333'}; + width: ${props => + (props.scaled && '100%') || + (props.size === 'base' && '173px') || + (props.size === 'middle' && '300px') || + (props.size === 'big' && '350px') || + (props.size === 'huge' && '500px') || + (props.size === 'content' && 'fit-content') + }; - ${state => state.isOpen && ` - .input-group-append > div { - -moz-transform: scaleY(-1); - -o-transform: scaleY(-1); - -webkit-transform: scaleY(-1); - transform: scaleY(-1); - } + position: relative; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + background: #FFFFFF; + border: 1px solid #D0D5DA; + border-radius: 3px; + + ${props => props.isDisabled && ` + border-color: #ECEEF1; + background: #F8F9F9; `} - - & > div > input { - &::placeholder { - font-family: Open Sans; - font-style: normal; - font-weight: 600; - font-size: 13px; - line-height: 20px; - ${props => !props.isDisabled && `color: #333333;`} - ${props => (!props.withBorder & !props.isDisabled) && `border-bottom: 1px dotted #333333;`} - opacity: 1; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } + height: 32px; + + :hover{ + border-color: ${state => state.isOpen ? '#2DA7DB' : '#A3A9AE'}; + + ${props => props.isDisabled && ` + border-color: #ECEEF1; + `} } `; -const StyledIcon = styled.span` - width: 16px; +const StyledComboButton = styled.div` + display: flex; + align-items: center; + justify-content: center; + height: 30px; margin-left: 8px; - line-height: 14px; +`; + +const StyledIcon = styled.div` + width: 16px; + margin-right: 8px; + margin-top: -2px; +`; + +const StyledOptionalItem = styled.div` + margin-right: 8px; +`; + +const StyledLabel = styled.div` +font-family: Open Sans; +font-style: normal; +font-weight: 600; +font-size: 13px; + +white-space: nowrap; + +margin-right: 8px; +`; + +const StyledArrowIcon = styled.div` + width: 8px; + margin-right: 8px; + margin-left: auto; + + ${state => state.isOpen && ` + transform: scale(1, -1); + margin-top: 8px; + `} `; class ComboBox extends React.PureComponent { @@ -79,8 +117,8 @@ class ComboBox extends React.PureComponent { toggle = (isOpen) => this.setState({ isOpen: isOpen }); comboBoxClick = (e) => { - if (this.props.isDisabled || !!e.target.closest('.input-group-prepend')) return; - + if (this.props.isDisabled || e.target.closest('.optionalBlock')) return; + this.setState({ option: this.props.option, isOpen: !this.state.isOpen @@ -110,7 +148,7 @@ class ComboBox extends React.PureComponent { getSelectedLabel = () => { const selectedItem = this.getSelected(); - return selectedItem ? selectedItem.label : "1-1"; + return selectedItem ? selectedItem.label : this.props.emptyOptionsPlaceholder; } componentDidUpdate(prevProps, prevState) { @@ -124,9 +162,9 @@ class ComboBox extends React.PureComponent { if (this.props.options.length !== prevProps.options.length) { //TODO: Move options from state const label = this.getSelectedLabel(); - this.setState({ + this.setState({ options: this.props.options, - boxLabel: label + boxLabel: label }); } @@ -139,52 +177,65 @@ class ComboBox extends React.PureComponent { render() { console.log("ComboBox render"); - const dropDownMaxHeightProp = this.props.dropDownMaxHeight ? { maxHeight: this.props.dropDownMaxHeight } : {} + const { dropDownMaxHeight, isDisabled, directionX, directionY, scaled, children } = this.props; + const { boxLabel, boxIcon, isOpen, options } = this.state; + + const dropDownMaxHeightProp = dropDownMaxHeight ? { maxHeight: dropDownMaxHeight } : {}; + const dropDownManualWidthProp = scaled ? { manualWidth: '100%' } : {}; + const boxIconColor = isDisabled ? '#D0D5DA' : '#333333'; + const arrowIconColor = isDisabled ? '#D0D5DA' : '#A3A9AE'; return ( - - {this.state.boxIcon && + + + {children} + + {boxIcon && - {React.createElement(Icons[this.state.boxIcon], + {React.createElement(Icons[boxIcon], { - size: "scale", - color: this.props.isDisabled ? '#D0D5DA' : '#333333', + size: 'scale', + color: boxIconColor, isfill: true }) } - } - {this.props.children} - - {this.state.options.map((option) => - - )} - - + + } + + {boxLabel} + + + {React.createElement(Icons['ExpanderDownIcon'], + { + size: 'scale', + color: arrowIconColor, + isfill: true + }) + } + + + + {options.map((option) => + + )} + ); } @@ -199,13 +250,20 @@ ComboBox.propTypes = { ]), options: PropTypes.array, onSelect: PropTypes.func, - dropDownMaxHeight: PropTypes.string + dropDownMaxHeight: PropTypes.string, + emptyOptionsPlaceholder: PropTypes.string, + + size: PropTypes.oneOf(['base', 'middle', 'big', 'huge', 'content']), + scaled: PropTypes.bool, } ComboBox.defaultProps = { isDisabled: false, withBorder: true, - dropDownMaxHeight: null + dropDownMaxHeight: null, + emptyOptionsPlaceholder: 'Select', + size: 'base', + scaled: true } export default ComboBox; \ No newline at end of file diff --git a/web/ASC.Web.Components/src/components/paging/index.js b/web/ASC.Web.Components/src/components/paging/index.js index 5750f136ab..fb74cde1f0 100644 --- a/web/ASC.Web.Components/src/components/paging/index.js +++ b/web/ASC.Web.Components/src/components/paging/index.js @@ -8,26 +8,27 @@ import device from '../device' const StyledPaging = styled.div` - display: flex; - flex-direction: row; - justify-content: flex-start; + display: flex; + flex-direction: row; + justify-content: flex-start; - & > button, div:not(:last-of-type) { - margin-right: 8px; - } + & > button { + margin-right: 8px; + width: 110px; + } `; const StyledOnPage = styled.div` - width: 120px; - margin-left: auto; + margin-left: auto; + margin-right: 0px; - @media ${device.mobile} { - display: none; - } + @media ${device.mobile} { + display: none; + } `; const StyledPage = styled.div` - + margin-right: 8px; `; const previousAction = () => { @@ -52,13 +53,13 @@ const Paging = props => { return ( -