@xaypay/tui 0.0.82 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +54 -14
- package/dist/index.js +54 -14
- package/package.json +1 -1
- package/src/components/autocomplate/autocomplate.stories.js +1 -1
- package/src/components/input/index.js +33 -4
- package/src/components/input/input.module.css +12 -0
- package/src/components/input/input.stories.js +3 -1
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +4 -3
- package/src/components/newAutocomplete/index.js +16 -8
- package/src/components/select/index.js +6 -4
- package/src/components/select/select.stories.js +1 -0
- package/src/components/table/table.stories.js +36 -13
- package/src/components/table/td.js +29 -0
package/dist/index.es.js
CHANGED
|
@@ -657,13 +657,14 @@ Modal.defaultProps = {
|
|
|
657
657
|
type: 'content'
|
|
658
658
|
};
|
|
659
659
|
|
|
660
|
-
var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
661
|
-
var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k"};
|
|
660
|
+
var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
661
|
+
var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
|
|
662
662
|
styleInject(css_248z$b);
|
|
663
663
|
|
|
664
664
|
const InputTypes = {
|
|
665
665
|
TEL: 'tel',
|
|
666
666
|
TEXT: "text",
|
|
667
|
+
NUMBER: 'number',
|
|
667
668
|
PASSWORD: "password"
|
|
668
669
|
};
|
|
669
670
|
const P = styled.span`
|
|
@@ -697,6 +698,8 @@ const Input = ({
|
|
|
697
698
|
errorSize,
|
|
698
699
|
labelSize,
|
|
699
700
|
maxLength,
|
|
701
|
+
minNumSize,
|
|
702
|
+
maxNumSize,
|
|
700
703
|
labelColor,
|
|
701
704
|
errorColor,
|
|
702
705
|
borderRight,
|
|
@@ -731,7 +734,7 @@ const Input = ({
|
|
|
731
734
|
const [innerErrorMessage, setInnerErrorMessage] = useState('');
|
|
732
735
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
733
736
|
const configStyles = compereConfigs();
|
|
734
|
-
const classProps = classnames(className ? className : configStyles.INPUT.className);
|
|
737
|
+
const classProps = classnames(className ? className : configStyles.INPUT.className, type === 'number' ? styles$9['inp-num'] : '');
|
|
735
738
|
const errorShow = keyframes`
|
|
736
739
|
100% {
|
|
737
740
|
bottom: '-20px';
|
|
@@ -773,13 +776,33 @@ const Input = ({
|
|
|
773
776
|
}
|
|
774
777
|
}
|
|
775
778
|
}
|
|
776
|
-
if (
|
|
779
|
+
if (type === 'number') {
|
|
780
|
+
if (minNumSize && currentValue < minNumSize) {
|
|
781
|
+
setInnerValue(minNumSize);
|
|
782
|
+
if (change) {
|
|
783
|
+
change(minNumSize);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (maxNumSize && currentValue > maxNumSize) {
|
|
787
|
+
setInnerValue(maxNumSize);
|
|
788
|
+
if (change) {
|
|
789
|
+
change(maxNumSize);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
if (currentValue === '') {
|
|
793
|
+
setInnerValue('');
|
|
794
|
+
if (change) {
|
|
795
|
+
change('');
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (maxLength && currentValue.length > maxLength && type !== 'tel' && type !== 'number') {
|
|
777
800
|
setInnerValue(currentValue.substr(0, maxLength));
|
|
778
801
|
if (change) {
|
|
779
802
|
change(currentValue.substr(0, maxLength));
|
|
780
803
|
}
|
|
781
804
|
}
|
|
782
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
805
|
+
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel' && type !== 'number') {
|
|
783
806
|
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
784
807
|
if (change) {
|
|
785
808
|
change(currentValue);
|
|
@@ -892,6 +915,8 @@ const Input = ({
|
|
|
892
915
|
name: name ? name : `tui_${random}_tui`,
|
|
893
916
|
placeholder: placeholder ? placeholder : '',
|
|
894
917
|
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
918
|
+
min: type === 'number' && minNumSize ? minNumSize : '',
|
|
919
|
+
max: type === 'number' && maxNumSize ? maxNumSize : '',
|
|
895
920
|
style: {
|
|
896
921
|
border: 'none',
|
|
897
922
|
outline: 'none',
|
|
@@ -960,6 +985,8 @@ Input.propTypes = {
|
|
|
960
985
|
errorLeft: PropTypes.string,
|
|
961
986
|
labelSize: PropTypes.string,
|
|
962
987
|
maxLength: PropTypes.number,
|
|
988
|
+
minNumSize: PropTypes.number,
|
|
989
|
+
maxNumSize: PropTypes.number,
|
|
963
990
|
errorColor: PropTypes.string,
|
|
964
991
|
labelColor: PropTypes.string,
|
|
965
992
|
borderRight: PropTypes.string,
|
|
@@ -1185,6 +1212,7 @@ const Select = ({
|
|
|
1185
1212
|
closeIcon,
|
|
1186
1213
|
errorZindex,
|
|
1187
1214
|
errorMessage,
|
|
1215
|
+
showCloseIcon,
|
|
1188
1216
|
defaultOption,
|
|
1189
1217
|
multipleCheckbox,
|
|
1190
1218
|
label,
|
|
@@ -1387,7 +1415,7 @@ const Select = ({
|
|
|
1387
1415
|
}
|
|
1388
1416
|
}) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default.createElement("div", {
|
|
1389
1417
|
className: `${styles$7['select-content-top-icon']}`
|
|
1390
|
-
}, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default.createElement("span", null, newSelected.length), !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
1418
|
+
}, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default.createElement("span", null, newSelected.length), showCloseIcon && !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
1391
1419
|
className: `${styles$7['close-icon']}`,
|
|
1392
1420
|
onClick: disabled ? _ => _ : handleClearSelect,
|
|
1393
1421
|
style: {
|
|
@@ -1454,6 +1482,7 @@ Select.propTypes = {
|
|
|
1454
1482
|
className: PropTypes.string,
|
|
1455
1483
|
arrowIcon: PropTypes.element,
|
|
1456
1484
|
closeIcon: PropTypes.element,
|
|
1485
|
+
showCloseIcon: PropTypes.bool,
|
|
1457
1486
|
errorZindex: PropTypes.number,
|
|
1458
1487
|
errorMessage: PropTypes.string,
|
|
1459
1488
|
defaultOption: PropTypes.string,
|
|
@@ -3736,6 +3765,7 @@ const NewAutocomplete = ({
|
|
|
3736
3765
|
change,
|
|
3737
3766
|
options,
|
|
3738
3767
|
getItem,
|
|
3768
|
+
keyNames,
|
|
3739
3769
|
required,
|
|
3740
3770
|
disabled,
|
|
3741
3771
|
selected,
|
|
@@ -3775,6 +3805,7 @@ const NewAutocomplete = ({
|
|
|
3775
3805
|
contentTopBoxSizing,
|
|
3776
3806
|
contentTopLineHeight,
|
|
3777
3807
|
contentBottomMaxWidth,
|
|
3808
|
+
contentTopBorderHover,
|
|
3778
3809
|
contentBottomOverflow,
|
|
3779
3810
|
contentBottomPosition,
|
|
3780
3811
|
contentBottomRowColor,
|
|
@@ -3782,6 +3813,7 @@ const NewAutocomplete = ({
|
|
|
3782
3813
|
contentBottomBoxShadow,
|
|
3783
3814
|
contentBottomRowHeight,
|
|
3784
3815
|
contentBottomRowCursor,
|
|
3816
|
+
contentTopBorderActive,
|
|
3785
3817
|
contentBottomRowDisplay,
|
|
3786
3818
|
contentBottomRowPadding,
|
|
3787
3819
|
contentBottomRowFontSize,
|
|
@@ -3792,8 +3824,6 @@ const NewAutocomplete = ({
|
|
|
3792
3824
|
contentBottomRowAlignItems,
|
|
3793
3825
|
contentBottomRowTransition,
|
|
3794
3826
|
contentBottomRowHoverColor,
|
|
3795
|
-
contentTopBorderHover,
|
|
3796
|
-
contentTopBorderActive,
|
|
3797
3827
|
contentBottomInnerOverflowY,
|
|
3798
3828
|
contentBottomInnerOverflowX,
|
|
3799
3829
|
contentBottomInnerMaxHeight,
|
|
@@ -3804,6 +3834,7 @@ const NewAutocomplete = ({
|
|
|
3804
3834
|
contentBottomRowHoverBackgroundColor,
|
|
3805
3835
|
...props
|
|
3806
3836
|
}) => {
|
|
3837
|
+
const [id, setId] = useState('');
|
|
3807
3838
|
const [show, setShow] = useState(false);
|
|
3808
3839
|
const [isHover, setIsHover] = useState(false);
|
|
3809
3840
|
const [isFocus, setIsFocus] = useState(false);
|
|
@@ -3840,18 +3871,23 @@ const NewAutocomplete = ({
|
|
|
3840
3871
|
};
|
|
3841
3872
|
const handleChange = e => {
|
|
3842
3873
|
const value = e.target.value;
|
|
3874
|
+
const currentId = e.target.id;
|
|
3843
3875
|
value.length > 0 ? setShow(true) : setShow(false);
|
|
3844
3876
|
setInnerValue(value);
|
|
3845
3877
|
if (value.length >= searchCount) {
|
|
3846
|
-
change(
|
|
3878
|
+
change({
|
|
3879
|
+
name: value,
|
|
3880
|
+
id: currentId
|
|
3881
|
+
});
|
|
3847
3882
|
} else {
|
|
3848
3883
|
change('');
|
|
3849
3884
|
}
|
|
3850
3885
|
};
|
|
3851
3886
|
const handleClick = selectedValue => {
|
|
3852
3887
|
setShow(false);
|
|
3853
|
-
|
|
3888
|
+
setId(selectedValue.id);
|
|
3854
3889
|
setInnerValue(selectedValue.name);
|
|
3890
|
+
getItem(selectedValue);
|
|
3855
3891
|
};
|
|
3856
3892
|
const optionList = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, show && innerOptions && !disabled ? innerOptions.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
3857
3893
|
style: {
|
|
@@ -3898,7 +3934,7 @@ const NewAutocomplete = ({
|
|
|
3898
3934
|
marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
|
|
3899
3935
|
backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
3900
3936
|
}
|
|
3901
|
-
}, item.name);
|
|
3937
|
+
}, item[keyNames.name]);
|
|
3902
3938
|
}))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default.createElement("span", {
|
|
3903
3939
|
style: {
|
|
3904
3940
|
position: 'absolute',
|
|
@@ -3932,11 +3968,13 @@ const NewAutocomplete = ({
|
|
|
3932
3968
|
}, [change]);
|
|
3933
3969
|
useEffect(() => {
|
|
3934
3970
|
if (selected) {
|
|
3935
|
-
|
|
3971
|
+
setId(selected[keyNames.id]);
|
|
3972
|
+
setInnerValue(selected[keyNames.name]);
|
|
3936
3973
|
} else {
|
|
3974
|
+
setId('');
|
|
3937
3975
|
setInnerValue('');
|
|
3938
3976
|
}
|
|
3939
|
-
}, [selected
|
|
3977
|
+
}, [selected]);
|
|
3940
3978
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label ? /*#__PURE__*/React__default.createElement("label", {
|
|
3941
3979
|
style: {
|
|
3942
3980
|
color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
|
|
@@ -3960,6 +3998,7 @@ const NewAutocomplete = ({
|
|
|
3960
3998
|
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
|
|
3961
3999
|
}
|
|
3962
4000
|
}, /*#__PURE__*/React__default.createElement("input", _extends({
|
|
4001
|
+
id: id,
|
|
3963
4002
|
type: "text",
|
|
3964
4003
|
value: innerValue,
|
|
3965
4004
|
disabled: disabled,
|
|
@@ -4003,7 +4042,8 @@ NewAutocomplete.propTypes = {
|
|
|
4003
4042
|
label: PropTypes.string,
|
|
4004
4043
|
required: PropTypes.bool,
|
|
4005
4044
|
disabled: PropTypes.bool,
|
|
4006
|
-
|
|
4045
|
+
keyNames: PropTypes.object,
|
|
4046
|
+
selected: PropTypes.object,
|
|
4007
4047
|
errorSize: PropTypes.string,
|
|
4008
4048
|
marginTop: PropTypes.string,
|
|
4009
4049
|
labelSize: PropTypes.string,
|
package/dist/index.js
CHANGED
|
@@ -687,13 +687,14 @@ Modal.defaultProps = {
|
|
|
687
687
|
type: 'content'
|
|
688
688
|
};
|
|
689
689
|
|
|
690
|
-
var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
691
|
-
var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k"};
|
|
690
|
+
var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
691
|
+
var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
|
|
692
692
|
styleInject(css_248z$b);
|
|
693
693
|
|
|
694
694
|
const InputTypes = {
|
|
695
695
|
TEL: 'tel',
|
|
696
696
|
TEXT: "text",
|
|
697
|
+
NUMBER: 'number',
|
|
697
698
|
PASSWORD: "password"
|
|
698
699
|
};
|
|
699
700
|
const P = styled__default["default"].span`
|
|
@@ -727,6 +728,8 @@ const Input = ({
|
|
|
727
728
|
errorSize,
|
|
728
729
|
labelSize,
|
|
729
730
|
maxLength,
|
|
731
|
+
minNumSize,
|
|
732
|
+
maxNumSize,
|
|
730
733
|
labelColor,
|
|
731
734
|
errorColor,
|
|
732
735
|
borderRight,
|
|
@@ -761,7 +764,7 @@ const Input = ({
|
|
|
761
764
|
const [innerErrorMessage, setInnerErrorMessage] = React.useState('');
|
|
762
765
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
763
766
|
const configStyles = compereConfigs();
|
|
764
|
-
const classProps = classnames__default["default"](className ? className : configStyles.INPUT.className);
|
|
767
|
+
const classProps = classnames__default["default"](className ? className : configStyles.INPUT.className, type === 'number' ? styles$9['inp-num'] : '');
|
|
765
768
|
const errorShow = styled.keyframes`
|
|
766
769
|
100% {
|
|
767
770
|
bottom: '-20px';
|
|
@@ -803,13 +806,33 @@ const Input = ({
|
|
|
803
806
|
}
|
|
804
807
|
}
|
|
805
808
|
}
|
|
806
|
-
if (
|
|
809
|
+
if (type === 'number') {
|
|
810
|
+
if (minNumSize && currentValue < minNumSize) {
|
|
811
|
+
setInnerValue(minNumSize);
|
|
812
|
+
if (change) {
|
|
813
|
+
change(minNumSize);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (maxNumSize && currentValue > maxNumSize) {
|
|
817
|
+
setInnerValue(maxNumSize);
|
|
818
|
+
if (change) {
|
|
819
|
+
change(maxNumSize);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (currentValue === '') {
|
|
823
|
+
setInnerValue('');
|
|
824
|
+
if (change) {
|
|
825
|
+
change('');
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
if (maxLength && currentValue.length > maxLength && type !== 'tel' && type !== 'number') {
|
|
807
830
|
setInnerValue(currentValue.substr(0, maxLength));
|
|
808
831
|
if (change) {
|
|
809
832
|
change(currentValue.substr(0, maxLength));
|
|
810
833
|
}
|
|
811
834
|
}
|
|
812
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
835
|
+
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel' && type !== 'number') {
|
|
813
836
|
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
814
837
|
if (change) {
|
|
815
838
|
change(currentValue);
|
|
@@ -922,6 +945,8 @@ const Input = ({
|
|
|
922
945
|
name: name ? name : `tui_${random}_tui`,
|
|
923
946
|
placeholder: placeholder ? placeholder : '',
|
|
924
947
|
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
948
|
+
min: type === 'number' && minNumSize ? minNumSize : '',
|
|
949
|
+
max: type === 'number' && maxNumSize ? maxNumSize : '',
|
|
925
950
|
style: {
|
|
926
951
|
border: 'none',
|
|
927
952
|
outline: 'none',
|
|
@@ -990,6 +1015,8 @@ Input.propTypes = {
|
|
|
990
1015
|
errorLeft: PropTypes__default["default"].string,
|
|
991
1016
|
labelSize: PropTypes__default["default"].string,
|
|
992
1017
|
maxLength: PropTypes__default["default"].number,
|
|
1018
|
+
minNumSize: PropTypes__default["default"].number,
|
|
1019
|
+
maxNumSize: PropTypes__default["default"].number,
|
|
993
1020
|
errorColor: PropTypes__default["default"].string,
|
|
994
1021
|
labelColor: PropTypes__default["default"].string,
|
|
995
1022
|
borderRight: PropTypes__default["default"].string,
|
|
@@ -1215,6 +1242,7 @@ const Select = ({
|
|
|
1215
1242
|
closeIcon,
|
|
1216
1243
|
errorZindex,
|
|
1217
1244
|
errorMessage,
|
|
1245
|
+
showCloseIcon,
|
|
1218
1246
|
defaultOption,
|
|
1219
1247
|
multipleCheckbox,
|
|
1220
1248
|
label,
|
|
@@ -1417,7 +1445,7 @@ const Select = ({
|
|
|
1417
1445
|
}
|
|
1418
1446
|
}) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1419
1447
|
className: `${styles$7['select-content-top-icon']}`
|
|
1420
|
-
}, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default["default"].createElement("span", null, newSelected.length), !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1448
|
+
}, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default["default"].createElement("span", null, newSelected.length), showCloseIcon && !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1421
1449
|
className: `${styles$7['close-icon']}`,
|
|
1422
1450
|
onClick: disabled ? _ => _ : handleClearSelect,
|
|
1423
1451
|
style: {
|
|
@@ -1484,6 +1512,7 @@ Select.propTypes = {
|
|
|
1484
1512
|
className: PropTypes__default["default"].string,
|
|
1485
1513
|
arrowIcon: PropTypes__default["default"].element,
|
|
1486
1514
|
closeIcon: PropTypes__default["default"].element,
|
|
1515
|
+
showCloseIcon: PropTypes__default["default"].bool,
|
|
1487
1516
|
errorZindex: PropTypes__default["default"].number,
|
|
1488
1517
|
errorMessage: PropTypes__default["default"].string,
|
|
1489
1518
|
defaultOption: PropTypes__default["default"].string,
|
|
@@ -3766,6 +3795,7 @@ const NewAutocomplete = ({
|
|
|
3766
3795
|
change,
|
|
3767
3796
|
options,
|
|
3768
3797
|
getItem,
|
|
3798
|
+
keyNames,
|
|
3769
3799
|
required,
|
|
3770
3800
|
disabled,
|
|
3771
3801
|
selected,
|
|
@@ -3805,6 +3835,7 @@ const NewAutocomplete = ({
|
|
|
3805
3835
|
contentTopBoxSizing,
|
|
3806
3836
|
contentTopLineHeight,
|
|
3807
3837
|
contentBottomMaxWidth,
|
|
3838
|
+
contentTopBorderHover,
|
|
3808
3839
|
contentBottomOverflow,
|
|
3809
3840
|
contentBottomPosition,
|
|
3810
3841
|
contentBottomRowColor,
|
|
@@ -3812,6 +3843,7 @@ const NewAutocomplete = ({
|
|
|
3812
3843
|
contentBottomBoxShadow,
|
|
3813
3844
|
contentBottomRowHeight,
|
|
3814
3845
|
contentBottomRowCursor,
|
|
3846
|
+
contentTopBorderActive,
|
|
3815
3847
|
contentBottomRowDisplay,
|
|
3816
3848
|
contentBottomRowPadding,
|
|
3817
3849
|
contentBottomRowFontSize,
|
|
@@ -3822,8 +3854,6 @@ const NewAutocomplete = ({
|
|
|
3822
3854
|
contentBottomRowAlignItems,
|
|
3823
3855
|
contentBottomRowTransition,
|
|
3824
3856
|
contentBottomRowHoverColor,
|
|
3825
|
-
contentTopBorderHover,
|
|
3826
|
-
contentTopBorderActive,
|
|
3827
3857
|
contentBottomInnerOverflowY,
|
|
3828
3858
|
contentBottomInnerOverflowX,
|
|
3829
3859
|
contentBottomInnerMaxHeight,
|
|
@@ -3834,6 +3864,7 @@ const NewAutocomplete = ({
|
|
|
3834
3864
|
contentBottomRowHoverBackgroundColor,
|
|
3835
3865
|
...props
|
|
3836
3866
|
}) => {
|
|
3867
|
+
const [id, setId] = React.useState('');
|
|
3837
3868
|
const [show, setShow] = React.useState(false);
|
|
3838
3869
|
const [isHover, setIsHover] = React.useState(false);
|
|
3839
3870
|
const [isFocus, setIsFocus] = React.useState(false);
|
|
@@ -3870,18 +3901,23 @@ const NewAutocomplete = ({
|
|
|
3870
3901
|
};
|
|
3871
3902
|
const handleChange = e => {
|
|
3872
3903
|
const value = e.target.value;
|
|
3904
|
+
const currentId = e.target.id;
|
|
3873
3905
|
value.length > 0 ? setShow(true) : setShow(false);
|
|
3874
3906
|
setInnerValue(value);
|
|
3875
3907
|
if (value.length >= searchCount) {
|
|
3876
|
-
change(
|
|
3908
|
+
change({
|
|
3909
|
+
name: value,
|
|
3910
|
+
id: currentId
|
|
3911
|
+
});
|
|
3877
3912
|
} else {
|
|
3878
3913
|
change('');
|
|
3879
3914
|
}
|
|
3880
3915
|
};
|
|
3881
3916
|
const handleClick = selectedValue => {
|
|
3882
3917
|
setShow(false);
|
|
3883
|
-
|
|
3918
|
+
setId(selectedValue.id);
|
|
3884
3919
|
setInnerValue(selectedValue.name);
|
|
3920
|
+
getItem(selectedValue);
|
|
3885
3921
|
};
|
|
3886
3922
|
const optionList = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, show && innerOptions && !disabled ? innerOptions.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3887
3923
|
style: {
|
|
@@ -3928,7 +3964,7 @@ const NewAutocomplete = ({
|
|
|
3928
3964
|
marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
|
|
3929
3965
|
backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
3930
3966
|
}
|
|
3931
|
-
}, item.name);
|
|
3967
|
+
}, item[keyNames.name]);
|
|
3932
3968
|
}))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
3933
3969
|
style: {
|
|
3934
3970
|
position: 'absolute',
|
|
@@ -3962,11 +3998,13 @@ const NewAutocomplete = ({
|
|
|
3962
3998
|
}, [change]);
|
|
3963
3999
|
React.useEffect(() => {
|
|
3964
4000
|
if (selected) {
|
|
3965
|
-
|
|
4001
|
+
setId(selected[keyNames.id]);
|
|
4002
|
+
setInnerValue(selected[keyNames.name]);
|
|
3966
4003
|
} else {
|
|
4004
|
+
setId('');
|
|
3967
4005
|
setInnerValue('');
|
|
3968
4006
|
}
|
|
3969
|
-
}, [selected
|
|
4007
|
+
}, [selected]);
|
|
3970
4008
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
3971
4009
|
style: {
|
|
3972
4010
|
color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
|
|
@@ -3990,6 +4028,7 @@ const NewAutocomplete = ({
|
|
|
3990
4028
|
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
|
|
3991
4029
|
}
|
|
3992
4030
|
}, /*#__PURE__*/React__default["default"].createElement("input", _extends({
|
|
4031
|
+
id: id,
|
|
3993
4032
|
type: "text",
|
|
3994
4033
|
value: innerValue,
|
|
3995
4034
|
disabled: disabled,
|
|
@@ -4033,7 +4072,8 @@ NewAutocomplete.propTypes = {
|
|
|
4033
4072
|
label: PropTypes__default["default"].string,
|
|
4034
4073
|
required: PropTypes__default["default"].bool,
|
|
4035
4074
|
disabled: PropTypes__default["default"].bool,
|
|
4036
|
-
|
|
4075
|
+
keyNames: PropTypes__default["default"].object,
|
|
4076
|
+
selected: PropTypes__default["default"].object,
|
|
4037
4077
|
errorSize: PropTypes__default["default"].string,
|
|
4038
4078
|
marginTop: PropTypes__default["default"].string,
|
|
4039
4079
|
labelSize: PropTypes__default["default"].string,
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ Default.args = {
|
|
|
21
21
|
method: 'GET',
|
|
22
22
|
headers: {
|
|
23
23
|
'Content-Type': 'application/json',
|
|
24
|
-
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.
|
|
24
|
+
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjYyYTU0MzhmYjY3ODZmYzgzY2NkZmVkMGNlYzExZDZjY2IxNmRhNWJhYTVlOTMwMWVjNDU2MWRmYzIyMDcyYTc0ZjEyY2IxZGEzOTJlMjE5IiwiaWF0IjoxNjg2MDM0NTA0LjU5OTMzOSwibmJmIjoxNjg2MDM0NTA0LjU5OTM2NywiZXhwIjoxNjg2MDU5NzA0LjU4NDkxMiwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.DzzdZFLHiFTyUIlKIK25IMSxnjI0cQ5EaUT3vdMoZT3XjclPA1uohP4hiRr30Duy6psyOcPuQuZ2t8KuGUy5n500Di-Wbw0tZDVW-ctyOQNQRPjcTL41lN7xrTaRzxrkSa3KHlZT0_w4KjHTp32wo6XHWjLwrbZIFlBBbJv-bMBqj0KIcsLWHBMfHb2lU8UK6_xMgSbsV_E3FzrhbgmBeFifBTn9BVkduz450jWKmib5zKFRv4lqpFrMJo7gOQRj0-uQliCCdtnvOBW3QqBeT0Zl-RFH-Vc22GAxSYWF7PZ1M-tOZ2PlR7pyfJabp6nEtsRii5PhoejUBAynYmZBKxY-TvKGjfpOXcULm2w0zIqrV2KRf4acj189Kok_nE5rpReqc0xk6hxDdhyBPdBDtgm58c25G_fkkSpMJvDyZg0fqpCB7wkYfGpqeYH-eW4KYuZeReU1OyIKCTxBJhDfcFqZRb4x7TUIxNoFXknLhhU4mB7t75ZZxpUwtJRXqF_Ps8eiBWcfmt5uZfVQqzFXcBlx6lmDwBn7RIF0jy5oKvs6ss5mBjv0SdKSJrpRMa9GIVT9lUJDqKA15JZIGXdugjBXwlrzFfekePXA_7AAFrxgS0Dn7EZJCh7EmBdGG3slPLRtnkcVru2AOLHZ-aRPtVluzxgip9RU23VMVXvoX-I',
|
|
25
25
|
},
|
|
26
26
|
}).then((res)=> {
|
|
27
27
|
return res.json()
|
|
@@ -9,6 +9,7 @@ import styles from "./input.module.css";
|
|
|
9
9
|
export const InputTypes = {
|
|
10
10
|
TEL: 'tel',
|
|
11
11
|
TEXT: "text",
|
|
12
|
+
NUMBER: 'number',
|
|
12
13
|
PASSWORD: "password",
|
|
13
14
|
};
|
|
14
15
|
|
|
@@ -44,6 +45,8 @@ export const Input = ({
|
|
|
44
45
|
errorSize,
|
|
45
46
|
labelSize,
|
|
46
47
|
maxLength,
|
|
48
|
+
minNumSize,
|
|
49
|
+
maxNumSize,
|
|
47
50
|
labelColor,
|
|
48
51
|
errorColor,
|
|
49
52
|
borderRight,
|
|
@@ -80,7 +83,8 @@ export const Input = ({
|
|
|
80
83
|
const random = Math.floor((Math.random() * 1000) + 1);
|
|
81
84
|
const configStyles = compereConfigs();
|
|
82
85
|
const classProps = classnames(
|
|
83
|
-
className ? className : configStyles.INPUT.className
|
|
86
|
+
className ? className : configStyles.INPUT.className,
|
|
87
|
+
type === 'number' ? styles['inp-num'] : ''
|
|
84
88
|
);
|
|
85
89
|
|
|
86
90
|
const errorShow = keyframes`
|
|
@@ -128,16 +132,37 @@ export const Input = ({
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (type === 'number') {
|
|
138
|
+
if (minNumSize && currentValue < minNumSize) {
|
|
139
|
+
setInnerValue(minNumSize);
|
|
140
|
+
if (change) {
|
|
141
|
+
change(minNumSize);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (maxNumSize && currentValue > maxNumSize) {
|
|
145
|
+
setInnerValue(maxNumSize);
|
|
146
|
+
if (change) {
|
|
147
|
+
change(maxNumSize);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (currentValue === '') {
|
|
151
|
+
setInnerValue('');
|
|
152
|
+
if (change) {
|
|
153
|
+
change('');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
132
157
|
|
|
133
|
-
if (maxLength && currentValue.length > maxLength && type !== 'tel') {
|
|
158
|
+
if (maxLength && currentValue.length > maxLength && type !== 'tel' && type !== 'number') {
|
|
134
159
|
setInnerValue(currentValue.substr(0, maxLength));
|
|
135
160
|
if (change) {
|
|
136
161
|
change(currentValue.substr(0, maxLength));
|
|
137
162
|
}
|
|
138
163
|
}
|
|
139
164
|
|
|
140
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
165
|
+
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel' && type !== 'number') {
|
|
141
166
|
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
142
167
|
if (change) {
|
|
143
168
|
change(currentValue);
|
|
@@ -280,6 +305,8 @@ export const Input = ({
|
|
|
280
305
|
name={name ? name : `tui_${random}_tui`}
|
|
281
306
|
placeholder={placeholder ? placeholder : ''}
|
|
282
307
|
autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
|
|
308
|
+
min={type === 'number' && minNumSize ? minNumSize: ''}
|
|
309
|
+
max={type === 'number' && maxNumSize ? maxNumSize : ''}
|
|
283
310
|
style={{
|
|
284
311
|
border: 'none',
|
|
285
312
|
outline: 'none',
|
|
@@ -368,6 +395,8 @@ Input.propTypes = {
|
|
|
368
395
|
errorLeft: PropTypes.string,
|
|
369
396
|
labelSize: PropTypes.string,
|
|
370
397
|
maxLength: PropTypes.number,
|
|
398
|
+
minNumSize: PropTypes.number,
|
|
399
|
+
maxNumSize: PropTypes.number,
|
|
371
400
|
errorColor: PropTypes.string,
|
|
372
401
|
labelColor: PropTypes.string,
|
|
373
402
|
borderRight: PropTypes.string,
|
|
@@ -20,6 +20,18 @@ input:-webkit-autofill:active {
|
|
|
20
20
|
animation-fill-mode: forwards;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/* Works for Chrome, Safari, Edge, Opera */
|
|
24
|
+
.inp-num::-webkit-outer-spin-button,
|
|
25
|
+
.inp-num::-webkit-inner-spin-button {
|
|
26
|
+
-webkit-appearance: none;
|
|
27
|
+
margin: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Works for Firefox */
|
|
31
|
+
.inp-num[type="number"] {
|
|
32
|
+
-moz-appearance: textfield;
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
@keyframes error-show {
|
|
24
36
|
100% {
|
|
25
37
|
bottom: -20px;
|
|
@@ -24,11 +24,11 @@ const Template = (args) => {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const handleChange = (value) => {
|
|
27
|
-
fetch(`http://dev2.govazd-api.yerevan.am/api/v1/companies/autocomplete?slug=${value}`, {
|
|
27
|
+
fetch(`http://dev2.govazd-api.yerevan.am/api/v1/companies/autocomplete?slug=${value.name ? value.name : ''}`, {
|
|
28
28
|
method: 'GET',
|
|
29
29
|
headers: {
|
|
30
30
|
'Content-Type': 'application/json',
|
|
31
|
-
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.
|
|
31
|
+
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjYyYTU0MzhmYjY3ODZmYzgzY2NkZmVkMGNlYzExZDZjY2IxNmRhNWJhYTVlOTMwMWVjNDU2MWRmYzIyMDcyYTc0ZjEyY2IxZGEzOTJlMjE5IiwiaWF0IjoxNjg2MDM0NTA0LjU5OTMzOSwibmJmIjoxNjg2MDM0NTA0LjU5OTM2NywiZXhwIjoxNjg2MDU5NzA0LjU4NDkxMiwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.DzzdZFLHiFTyUIlKIK25IMSxnjI0cQ5EaUT3vdMoZT3XjclPA1uohP4hiRr30Duy6psyOcPuQuZ2t8KuGUy5n500Di-Wbw0tZDVW-ctyOQNQRPjcTL41lN7xrTaRzxrkSa3KHlZT0_w4KjHTp32wo6XHWjLwrbZIFlBBbJv-bMBqj0KIcsLWHBMfHb2lU8UK6_xMgSbsV_E3FzrhbgmBeFifBTn9BVkduz450jWKmib5zKFRv4lqpFrMJo7gOQRj0-uQliCCdtnvOBW3QqBeT0Zl-RFH-Vc22GAxSYWF7PZ1M-tOZ2PlR7pyfJabp6nEtsRii5PhoejUBAynYmZBKxY-TvKGjfpOXcULm2w0zIqrV2KRf4acj189Kok_nE5rpReqc0xk6hxDdhyBPdBDtgm58c25G_fkkSpMJvDyZg0fqpCB7wkYfGpqeYH-eW4KYuZeReU1OyIKCTxBJhDfcFqZRb4x7TUIxNoFXknLhhU4mB7t75ZZxpUwtJRXqF_Ps8eiBWcfmt5uZfVQqzFXcBlx6lmDwBn7RIF0jy5oKvs6ss5mBjv0SdKSJrpRMa9GIVT9lUJDqKA15JZIGXdugjBXwlrzFfekePXA_7AAFrxgS0Dn7EZJCh7EmBdGG3slPLRtnkcVru2AOLHZ-aRPtVluzxgip9RU23VMVXvoX-I',
|
|
32
32
|
},
|
|
33
33
|
}).then((res)=> {
|
|
34
34
|
return res.json()
|
|
@@ -47,5 +47,6 @@ const Template = (args) => {
|
|
|
47
47
|
export const Default = Template.bind({});
|
|
48
48
|
Default.args = {
|
|
49
49
|
searchCount: 3,
|
|
50
|
-
|
|
50
|
+
keyNames: { name: 'name', id: 'bbb' },
|
|
51
|
+
selected: { "bbb":"0", "name":"gasdfgdsfgdsg" },
|
|
51
52
|
}
|
|
@@ -10,6 +10,7 @@ export const NewAutocomplete = ({
|
|
|
10
10
|
change,
|
|
11
11
|
options,
|
|
12
12
|
getItem,
|
|
13
|
+
keyNames,
|
|
13
14
|
required,
|
|
14
15
|
disabled,
|
|
15
16
|
selected,
|
|
@@ -49,6 +50,7 @@ export const NewAutocomplete = ({
|
|
|
49
50
|
contentTopBoxSizing,
|
|
50
51
|
contentTopLineHeight,
|
|
51
52
|
contentBottomMaxWidth,
|
|
53
|
+
contentTopBorderHover,
|
|
52
54
|
contentBottomOverflow,
|
|
53
55
|
contentBottomPosition,
|
|
54
56
|
contentBottomRowColor,
|
|
@@ -56,6 +58,7 @@ export const NewAutocomplete = ({
|
|
|
56
58
|
contentBottomBoxShadow,
|
|
57
59
|
contentBottomRowHeight,
|
|
58
60
|
contentBottomRowCursor,
|
|
61
|
+
contentTopBorderActive,
|
|
59
62
|
contentBottomRowDisplay,
|
|
60
63
|
contentBottomRowPadding,
|
|
61
64
|
contentBottomRowFontSize,
|
|
@@ -66,8 +69,6 @@ export const NewAutocomplete = ({
|
|
|
66
69
|
contentBottomRowAlignItems,
|
|
67
70
|
contentBottomRowTransition,
|
|
68
71
|
contentBottomRowHoverColor,
|
|
69
|
-
contentTopBorderHover,
|
|
70
|
-
contentTopBorderActive,
|
|
71
72
|
contentBottomInnerOverflowY,
|
|
72
73
|
contentBottomInnerOverflowX,
|
|
73
74
|
contentBottomInnerMaxHeight,
|
|
@@ -78,6 +79,7 @@ export const NewAutocomplete = ({
|
|
|
78
79
|
contentBottomRowHoverBackgroundColor,
|
|
79
80
|
...props
|
|
80
81
|
}) => {
|
|
82
|
+
const [id, setId] = useState('');
|
|
81
83
|
const [show, setShow] = useState(false);
|
|
82
84
|
const [isHover, setIsHover] = useState(false);
|
|
83
85
|
const [isFocus, setIsFocus] = useState(false);
|
|
@@ -123,10 +125,11 @@ export const NewAutocomplete = ({
|
|
|
123
125
|
|
|
124
126
|
const handleChange = (e) => {
|
|
125
127
|
const value = e.target.value;
|
|
128
|
+
const currentId = e.target.id;
|
|
126
129
|
value.length > 0 ? setShow(true) : setShow(false);
|
|
127
130
|
setInnerValue(value);
|
|
128
131
|
if (value.length >= searchCount) {
|
|
129
|
-
change(value);
|
|
132
|
+
change({ name: value, id: currentId });
|
|
130
133
|
} else {
|
|
131
134
|
change('');
|
|
132
135
|
}
|
|
@@ -134,8 +137,9 @@ export const NewAutocomplete = ({
|
|
|
134
137
|
|
|
135
138
|
const handleClick = (selectedValue) => {
|
|
136
139
|
setShow(false);
|
|
137
|
-
|
|
140
|
+
setId(selectedValue.id);
|
|
138
141
|
setInnerValue(selectedValue.name);
|
|
142
|
+
getItem(selectedValue);
|
|
139
143
|
};
|
|
140
144
|
|
|
141
145
|
const optionList = (
|
|
@@ -201,7 +205,7 @@ export const NewAutocomplete = ({
|
|
|
201
205
|
backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
202
206
|
}}
|
|
203
207
|
>
|
|
204
|
-
{item.name}
|
|
208
|
+
{item[keyNames.name]}
|
|
205
209
|
</p>
|
|
206
210
|
)
|
|
207
211
|
})
|
|
@@ -260,11 +264,13 @@ export const NewAutocomplete = ({
|
|
|
260
264
|
|
|
261
265
|
useEffect(() => {
|
|
262
266
|
if (selected) {
|
|
263
|
-
|
|
267
|
+
setId(selected[keyNames.id]);
|
|
268
|
+
setInnerValue(selected[keyNames.name]);
|
|
264
269
|
} else {
|
|
270
|
+
setId('');
|
|
265
271
|
setInnerValue('');
|
|
266
272
|
}
|
|
267
|
-
}, [selected
|
|
273
|
+
}, [selected]);
|
|
268
274
|
|
|
269
275
|
return (
|
|
270
276
|
<>
|
|
@@ -302,6 +308,7 @@ export const NewAutocomplete = ({
|
|
|
302
308
|
}}
|
|
303
309
|
>
|
|
304
310
|
<input
|
|
311
|
+
id={id}
|
|
305
312
|
type='text'
|
|
306
313
|
value={innerValue}
|
|
307
314
|
disabled={disabled}
|
|
@@ -366,7 +373,8 @@ NewAutocomplete.propTypes = {
|
|
|
366
373
|
label: PropTypes.string,
|
|
367
374
|
required: PropTypes.bool,
|
|
368
375
|
disabled: PropTypes.bool,
|
|
369
|
-
|
|
376
|
+
keyNames: PropTypes.object,
|
|
377
|
+
selected: PropTypes.object,
|
|
370
378
|
errorSize: PropTypes.string,
|
|
371
379
|
marginTop: PropTypes.string,
|
|
372
380
|
labelSize: PropTypes.string,
|
|
@@ -23,6 +23,7 @@ export const Select = ({
|
|
|
23
23
|
closeIcon,
|
|
24
24
|
errorZindex,
|
|
25
25
|
errorMessage,
|
|
26
|
+
showCloseIcon,
|
|
26
27
|
defaultOption,
|
|
27
28
|
multipleCheckbox,
|
|
28
29
|
|
|
@@ -263,11 +264,11 @@ export const Select = ({
|
|
|
263
264
|
!disabled && multiple && newSelected.length > 1 && <span>{newSelected.length}</span>
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
{!disabled && newSelected && newSelected.length > 0 &&
|
|
267
|
+
{showCloseIcon && !disabled && newSelected && newSelected.length > 0 &&
|
|
267
268
|
<div
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
className={`${styles['close-icon']}`}
|
|
270
|
+
onClick={disabled ? _ => _ : handleClearSelect}
|
|
271
|
+
style={{marginLeft: multiple && newSelected.length > 1 ? '17px' : '0px'}}
|
|
271
272
|
>
|
|
272
273
|
{ closeIcon ? closeIcon : <ReactCloseIcon /> }
|
|
273
274
|
</div>
|
|
@@ -367,6 +368,7 @@ Select.propTypes = {
|
|
|
367
368
|
className: PropTypes.string,
|
|
368
369
|
arrowIcon: PropTypes.element,
|
|
369
370
|
closeIcon: PropTypes.element,
|
|
371
|
+
showCloseIcon: PropTypes.bool,
|
|
370
372
|
errorZindex: PropTypes.number,
|
|
371
373
|
errorMessage: PropTypes.string,
|
|
372
374
|
defaultOption: PropTypes.string,
|
|
@@ -17,6 +17,7 @@ const Template = (args) => <Select label='' {...args} >Default</Select>;
|
|
|
17
17
|
|
|
18
18
|
export const Default = Template.bind({});
|
|
19
19
|
Default.args = {
|
|
20
|
+
showCloseIcon: true,
|
|
20
21
|
label: 'վարչական շրջան',
|
|
21
22
|
options: [{"bbb":"0", "value":"Արաբկիր"}, {"bbb":"1", "value":"Կենտրոն"}, {"bbb":"2", "value":"Մալաթիա"}],
|
|
22
23
|
onChange: (newValue)=> {
|
|
@@ -294,20 +294,43 @@ const bodyData = [
|
|
|
294
294
|
'text for => test',
|
|
295
295
|
]
|
|
296
296
|
},
|
|
297
|
-
create:
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
create: [
|
|
298
|
+
[
|
|
299
|
+
{
|
|
300
|
+
content: '21'
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
[
|
|
304
|
+
{
|
|
305
|
+
content: '13'
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
],
|
|
300
309
|
actions: [
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
310
|
+
[
|
|
311
|
+
{
|
|
312
|
+
id: 21031,
|
|
313
|
+
type: 'attach',
|
|
314
|
+
content: <ReactSVGAttach />
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: 21031,
|
|
318
|
+
type: 'plus',
|
|
319
|
+
content: <ReactSVGPlus />
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
{
|
|
324
|
+
id: 21031,
|
|
325
|
+
type: 'minus',
|
|
326
|
+
content: <ReactSVGMinus />
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: 21031,
|
|
330
|
+
type: 'delete',
|
|
331
|
+
content: <ReactSVGDelete />
|
|
332
|
+
}
|
|
333
|
+
]
|
|
311
334
|
]
|
|
312
335
|
}
|
|
313
336
|
];
|
|
@@ -57,6 +57,35 @@ const TD = ({
|
|
|
57
57
|
{ newItem.content }
|
|
58
58
|
</span>
|
|
59
59
|
)
|
|
60
|
+
} else if (newItem && Array.isArray(newItem)) {
|
|
61
|
+
return (
|
|
62
|
+
<span
|
|
63
|
+
style={{
|
|
64
|
+
display: 'inline-block',
|
|
65
|
+
marginRight: newIndex !== item.length - 1 ? '10px' : '0px',
|
|
66
|
+
borderRight: newIndex !== item.length - 1 ? '1px solid rgb(238, 238, 238)' : 'none'
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{
|
|
70
|
+
item[newIndex].map((iT, iN) => {
|
|
71
|
+
return <span
|
|
72
|
+
style={{
|
|
73
|
+
width: '32px',
|
|
74
|
+
height: '32px',
|
|
75
|
+
marginRight: '10px',
|
|
76
|
+
}}
|
|
77
|
+
id={iT.id ? iT.id : ''}
|
|
78
|
+
type={iT.type ? iT.type : ''}
|
|
79
|
+
className={styles['td-span']}
|
|
80
|
+
onClick={handleBodyActionClick}
|
|
81
|
+
key={`${iT.id || iT.content}_${iN}`}
|
|
82
|
+
>
|
|
83
|
+
{ iT.content }
|
|
84
|
+
</span>
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
</span>
|
|
88
|
+
);
|
|
60
89
|
} else {
|
|
61
90
|
return <span
|
|
62
91
|
key={`${newItem}_${newIndex}`}
|