@xaypay/tui 0.0.82 → 0.0.83
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 +22 -9
- package/dist/index.js +22 -9
- package/package.json +1 -1
- package/src/components/autocomplate/autocomplate.stories.js +1 -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 +24 -10
- package/src/components/table/td.js +22 -0
package/dist/index.es.js
CHANGED
|
@@ -1185,6 +1185,7 @@ const Select = ({
|
|
|
1185
1185
|
closeIcon,
|
|
1186
1186
|
errorZindex,
|
|
1187
1187
|
errorMessage,
|
|
1188
|
+
showCloseIcon,
|
|
1188
1189
|
defaultOption,
|
|
1189
1190
|
multipleCheckbox,
|
|
1190
1191
|
label,
|
|
@@ -1387,7 +1388,7 @@ const Select = ({
|
|
|
1387
1388
|
}
|
|
1388
1389
|
}) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default.createElement("div", {
|
|
1389
1390
|
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", {
|
|
1391
|
+
}, !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
1392
|
className: `${styles$7['close-icon']}`,
|
|
1392
1393
|
onClick: disabled ? _ => _ : handleClearSelect,
|
|
1393
1394
|
style: {
|
|
@@ -1454,6 +1455,7 @@ Select.propTypes = {
|
|
|
1454
1455
|
className: PropTypes.string,
|
|
1455
1456
|
arrowIcon: PropTypes.element,
|
|
1456
1457
|
closeIcon: PropTypes.element,
|
|
1458
|
+
showCloseIcon: PropTypes.bool,
|
|
1457
1459
|
errorZindex: PropTypes.number,
|
|
1458
1460
|
errorMessage: PropTypes.string,
|
|
1459
1461
|
defaultOption: PropTypes.string,
|
|
@@ -3736,6 +3738,7 @@ const NewAutocomplete = ({
|
|
|
3736
3738
|
change,
|
|
3737
3739
|
options,
|
|
3738
3740
|
getItem,
|
|
3741
|
+
keyNames,
|
|
3739
3742
|
required,
|
|
3740
3743
|
disabled,
|
|
3741
3744
|
selected,
|
|
@@ -3775,6 +3778,7 @@ const NewAutocomplete = ({
|
|
|
3775
3778
|
contentTopBoxSizing,
|
|
3776
3779
|
contentTopLineHeight,
|
|
3777
3780
|
contentBottomMaxWidth,
|
|
3781
|
+
contentTopBorderHover,
|
|
3778
3782
|
contentBottomOverflow,
|
|
3779
3783
|
contentBottomPosition,
|
|
3780
3784
|
contentBottomRowColor,
|
|
@@ -3782,6 +3786,7 @@ const NewAutocomplete = ({
|
|
|
3782
3786
|
contentBottomBoxShadow,
|
|
3783
3787
|
contentBottomRowHeight,
|
|
3784
3788
|
contentBottomRowCursor,
|
|
3789
|
+
contentTopBorderActive,
|
|
3785
3790
|
contentBottomRowDisplay,
|
|
3786
3791
|
contentBottomRowPadding,
|
|
3787
3792
|
contentBottomRowFontSize,
|
|
@@ -3792,8 +3797,6 @@ const NewAutocomplete = ({
|
|
|
3792
3797
|
contentBottomRowAlignItems,
|
|
3793
3798
|
contentBottomRowTransition,
|
|
3794
3799
|
contentBottomRowHoverColor,
|
|
3795
|
-
contentTopBorderHover,
|
|
3796
|
-
contentTopBorderActive,
|
|
3797
3800
|
contentBottomInnerOverflowY,
|
|
3798
3801
|
contentBottomInnerOverflowX,
|
|
3799
3802
|
contentBottomInnerMaxHeight,
|
|
@@ -3804,6 +3807,7 @@ const NewAutocomplete = ({
|
|
|
3804
3807
|
contentBottomRowHoverBackgroundColor,
|
|
3805
3808
|
...props
|
|
3806
3809
|
}) => {
|
|
3810
|
+
const [id, setId] = useState('');
|
|
3807
3811
|
const [show, setShow] = useState(false);
|
|
3808
3812
|
const [isHover, setIsHover] = useState(false);
|
|
3809
3813
|
const [isFocus, setIsFocus] = useState(false);
|
|
@@ -3840,18 +3844,23 @@ const NewAutocomplete = ({
|
|
|
3840
3844
|
};
|
|
3841
3845
|
const handleChange = e => {
|
|
3842
3846
|
const value = e.target.value;
|
|
3847
|
+
const currentId = e.target.id;
|
|
3843
3848
|
value.length > 0 ? setShow(true) : setShow(false);
|
|
3844
3849
|
setInnerValue(value);
|
|
3845
3850
|
if (value.length >= searchCount) {
|
|
3846
|
-
change(
|
|
3851
|
+
change({
|
|
3852
|
+
name: value,
|
|
3853
|
+
id: currentId
|
|
3854
|
+
});
|
|
3847
3855
|
} else {
|
|
3848
3856
|
change('');
|
|
3849
3857
|
}
|
|
3850
3858
|
};
|
|
3851
3859
|
const handleClick = selectedValue => {
|
|
3852
3860
|
setShow(false);
|
|
3853
|
-
|
|
3861
|
+
setId(selectedValue.id);
|
|
3854
3862
|
setInnerValue(selectedValue.name);
|
|
3863
|
+
getItem(selectedValue);
|
|
3855
3864
|
};
|
|
3856
3865
|
const optionList = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, show && innerOptions && !disabled ? innerOptions.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
3857
3866
|
style: {
|
|
@@ -3898,7 +3907,7 @@ const NewAutocomplete = ({
|
|
|
3898
3907
|
marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
|
|
3899
3908
|
backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
3900
3909
|
}
|
|
3901
|
-
}, item.name);
|
|
3910
|
+
}, item[keyNames.name]);
|
|
3902
3911
|
}))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default.createElement("span", {
|
|
3903
3912
|
style: {
|
|
3904
3913
|
position: 'absolute',
|
|
@@ -3932,11 +3941,13 @@ const NewAutocomplete = ({
|
|
|
3932
3941
|
}, [change]);
|
|
3933
3942
|
useEffect(() => {
|
|
3934
3943
|
if (selected) {
|
|
3935
|
-
|
|
3944
|
+
setId(selected[keyNames.id]);
|
|
3945
|
+
setInnerValue(selected[keyNames.name]);
|
|
3936
3946
|
} else {
|
|
3947
|
+
setId('');
|
|
3937
3948
|
setInnerValue('');
|
|
3938
3949
|
}
|
|
3939
|
-
}, [selected
|
|
3950
|
+
}, [selected]);
|
|
3940
3951
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label ? /*#__PURE__*/React__default.createElement("label", {
|
|
3941
3952
|
style: {
|
|
3942
3953
|
color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
|
|
@@ -3960,6 +3971,7 @@ const NewAutocomplete = ({
|
|
|
3960
3971
|
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
|
|
3961
3972
|
}
|
|
3962
3973
|
}, /*#__PURE__*/React__default.createElement("input", _extends({
|
|
3974
|
+
id: id,
|
|
3963
3975
|
type: "text",
|
|
3964
3976
|
value: innerValue,
|
|
3965
3977
|
disabled: disabled,
|
|
@@ -4003,7 +4015,8 @@ NewAutocomplete.propTypes = {
|
|
|
4003
4015
|
label: PropTypes.string,
|
|
4004
4016
|
required: PropTypes.bool,
|
|
4005
4017
|
disabled: PropTypes.bool,
|
|
4006
|
-
|
|
4018
|
+
keyNames: PropTypes.object,
|
|
4019
|
+
selected: PropTypes.object,
|
|
4007
4020
|
errorSize: PropTypes.string,
|
|
4008
4021
|
marginTop: PropTypes.string,
|
|
4009
4022
|
labelSize: PropTypes.string,
|
package/dist/index.js
CHANGED
|
@@ -1215,6 +1215,7 @@ const Select = ({
|
|
|
1215
1215
|
closeIcon,
|
|
1216
1216
|
errorZindex,
|
|
1217
1217
|
errorMessage,
|
|
1218
|
+
showCloseIcon,
|
|
1218
1219
|
defaultOption,
|
|
1219
1220
|
multipleCheckbox,
|
|
1220
1221
|
label,
|
|
@@ -1417,7 +1418,7 @@ const Select = ({
|
|
|
1417
1418
|
}
|
|
1418
1419
|
}) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1419
1420
|
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", {
|
|
1421
|
+
}, !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
1422
|
className: `${styles$7['close-icon']}`,
|
|
1422
1423
|
onClick: disabled ? _ => _ : handleClearSelect,
|
|
1423
1424
|
style: {
|
|
@@ -1484,6 +1485,7 @@ Select.propTypes = {
|
|
|
1484
1485
|
className: PropTypes__default["default"].string,
|
|
1485
1486
|
arrowIcon: PropTypes__default["default"].element,
|
|
1486
1487
|
closeIcon: PropTypes__default["default"].element,
|
|
1488
|
+
showCloseIcon: PropTypes__default["default"].bool,
|
|
1487
1489
|
errorZindex: PropTypes__default["default"].number,
|
|
1488
1490
|
errorMessage: PropTypes__default["default"].string,
|
|
1489
1491
|
defaultOption: PropTypes__default["default"].string,
|
|
@@ -3766,6 +3768,7 @@ const NewAutocomplete = ({
|
|
|
3766
3768
|
change,
|
|
3767
3769
|
options,
|
|
3768
3770
|
getItem,
|
|
3771
|
+
keyNames,
|
|
3769
3772
|
required,
|
|
3770
3773
|
disabled,
|
|
3771
3774
|
selected,
|
|
@@ -3805,6 +3808,7 @@ const NewAutocomplete = ({
|
|
|
3805
3808
|
contentTopBoxSizing,
|
|
3806
3809
|
contentTopLineHeight,
|
|
3807
3810
|
contentBottomMaxWidth,
|
|
3811
|
+
contentTopBorderHover,
|
|
3808
3812
|
contentBottomOverflow,
|
|
3809
3813
|
contentBottomPosition,
|
|
3810
3814
|
contentBottomRowColor,
|
|
@@ -3812,6 +3816,7 @@ const NewAutocomplete = ({
|
|
|
3812
3816
|
contentBottomBoxShadow,
|
|
3813
3817
|
contentBottomRowHeight,
|
|
3814
3818
|
contentBottomRowCursor,
|
|
3819
|
+
contentTopBorderActive,
|
|
3815
3820
|
contentBottomRowDisplay,
|
|
3816
3821
|
contentBottomRowPadding,
|
|
3817
3822
|
contentBottomRowFontSize,
|
|
@@ -3822,8 +3827,6 @@ const NewAutocomplete = ({
|
|
|
3822
3827
|
contentBottomRowAlignItems,
|
|
3823
3828
|
contentBottomRowTransition,
|
|
3824
3829
|
contentBottomRowHoverColor,
|
|
3825
|
-
contentTopBorderHover,
|
|
3826
|
-
contentTopBorderActive,
|
|
3827
3830
|
contentBottomInnerOverflowY,
|
|
3828
3831
|
contentBottomInnerOverflowX,
|
|
3829
3832
|
contentBottomInnerMaxHeight,
|
|
@@ -3834,6 +3837,7 @@ const NewAutocomplete = ({
|
|
|
3834
3837
|
contentBottomRowHoverBackgroundColor,
|
|
3835
3838
|
...props
|
|
3836
3839
|
}) => {
|
|
3840
|
+
const [id, setId] = React.useState('');
|
|
3837
3841
|
const [show, setShow] = React.useState(false);
|
|
3838
3842
|
const [isHover, setIsHover] = React.useState(false);
|
|
3839
3843
|
const [isFocus, setIsFocus] = React.useState(false);
|
|
@@ -3870,18 +3874,23 @@ const NewAutocomplete = ({
|
|
|
3870
3874
|
};
|
|
3871
3875
|
const handleChange = e => {
|
|
3872
3876
|
const value = e.target.value;
|
|
3877
|
+
const currentId = e.target.id;
|
|
3873
3878
|
value.length > 0 ? setShow(true) : setShow(false);
|
|
3874
3879
|
setInnerValue(value);
|
|
3875
3880
|
if (value.length >= searchCount) {
|
|
3876
|
-
change(
|
|
3881
|
+
change({
|
|
3882
|
+
name: value,
|
|
3883
|
+
id: currentId
|
|
3884
|
+
});
|
|
3877
3885
|
} else {
|
|
3878
3886
|
change('');
|
|
3879
3887
|
}
|
|
3880
3888
|
};
|
|
3881
3889
|
const handleClick = selectedValue => {
|
|
3882
3890
|
setShow(false);
|
|
3883
|
-
|
|
3891
|
+
setId(selectedValue.id);
|
|
3884
3892
|
setInnerValue(selectedValue.name);
|
|
3893
|
+
getItem(selectedValue);
|
|
3885
3894
|
};
|
|
3886
3895
|
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
3896
|
style: {
|
|
@@ -3928,7 +3937,7 @@ const NewAutocomplete = ({
|
|
|
3928
3937
|
marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
|
|
3929
3938
|
backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
3930
3939
|
}
|
|
3931
|
-
}, item.name);
|
|
3940
|
+
}, item[keyNames.name]);
|
|
3932
3941
|
}))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
3933
3942
|
style: {
|
|
3934
3943
|
position: 'absolute',
|
|
@@ -3962,11 +3971,13 @@ const NewAutocomplete = ({
|
|
|
3962
3971
|
}, [change]);
|
|
3963
3972
|
React.useEffect(() => {
|
|
3964
3973
|
if (selected) {
|
|
3965
|
-
|
|
3974
|
+
setId(selected[keyNames.id]);
|
|
3975
|
+
setInnerValue(selected[keyNames.name]);
|
|
3966
3976
|
} else {
|
|
3977
|
+
setId('');
|
|
3967
3978
|
setInnerValue('');
|
|
3968
3979
|
}
|
|
3969
|
-
}, [selected
|
|
3980
|
+
}, [selected]);
|
|
3970
3981
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
3971
3982
|
style: {
|
|
3972
3983
|
color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
|
|
@@ -3990,6 +4001,7 @@ const NewAutocomplete = ({
|
|
|
3990
4001
|
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
|
|
3991
4002
|
}
|
|
3992
4003
|
}, /*#__PURE__*/React__default["default"].createElement("input", _extends({
|
|
4004
|
+
id: id,
|
|
3993
4005
|
type: "text",
|
|
3994
4006
|
value: innerValue,
|
|
3995
4007
|
disabled: disabled,
|
|
@@ -4033,7 +4045,8 @@ NewAutocomplete.propTypes = {
|
|
|
4033
4045
|
label: PropTypes__default["default"].string,
|
|
4034
4046
|
required: PropTypes__default["default"].bool,
|
|
4035
4047
|
disabled: PropTypes__default["default"].bool,
|
|
4036
|
-
|
|
4048
|
+
keyNames: PropTypes__default["default"].object,
|
|
4049
|
+
selected: PropTypes__default["default"].object,
|
|
4037
4050
|
errorSize: PropTypes__default["default"].string,
|
|
4038
4051
|
marginTop: PropTypes__default["default"].string,
|
|
4039
4052
|
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()
|
|
@@ -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)=> {
|
|
@@ -298,16 +298,30 @@ const bodyData = [
|
|
|
298
298
|
content: '27.05.2022'
|
|
299
299
|
},
|
|
300
300
|
actions: [
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
301
|
+
[
|
|
302
|
+
{
|
|
303
|
+
id: 20037,
|
|
304
|
+
type: 'attach',
|
|
305
|
+
content: <ReactSVGAttach />
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: 20037,
|
|
309
|
+
type: 'plus',
|
|
310
|
+
content: <ReactSVGPlus />
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
[
|
|
314
|
+
{
|
|
315
|
+
id: 21031,
|
|
316
|
+
type: 'minus',
|
|
317
|
+
content: <ReactSVGMinus />
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: 21031,
|
|
321
|
+
type: 'delete',
|
|
322
|
+
content: <ReactSVGDelete />
|
|
323
|
+
}
|
|
324
|
+
]
|
|
311
325
|
]
|
|
312
326
|
}
|
|
313
327
|
];
|
|
@@ -57,6 +57,28 @@ const TD = ({
|
|
|
57
57
|
{ newItem.content }
|
|
58
58
|
</span>
|
|
59
59
|
)
|
|
60
|
+
} else if (newItem && Array.isArray(newItem)) {
|
|
61
|
+
const x = item[newIndex].map((iT, iN) => {
|
|
62
|
+
// console.log(iT, ' - - - ->>>>>>>>>>>>>>>>>>>>>>>');
|
|
63
|
+
// return <span key={`${iT.id}_${iN}`}>
|
|
64
|
+
// {iT}
|
|
65
|
+
// </span>;
|
|
66
|
+
return <span
|
|
67
|
+
style={{
|
|
68
|
+
width: '32px',
|
|
69
|
+
height: '32px',
|
|
70
|
+
marginRight: '10px'
|
|
71
|
+
}}
|
|
72
|
+
id={iT.id}
|
|
73
|
+
type={iT.type}
|
|
74
|
+
className={styles['td-span']}
|
|
75
|
+
key={`${iT.id}_${iN}`}
|
|
76
|
+
onClick={handleBodyActionClick}
|
|
77
|
+
>
|
|
78
|
+
{ iT.content }
|
|
79
|
+
</span>
|
|
80
|
+
});
|
|
81
|
+
console.log(x, 'x');
|
|
60
82
|
} else {
|
|
61
83
|
return <span
|
|
62
84
|
key={`${newItem}_${newIndex}`}
|