@xaypay/tui 0.0.121 → 0.0.123
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 +86 -73
- package/dist/index.js +86 -73
- package/package.json +1 -1
- package/tui.config.js +4 -3
package/dist/index.es.js
CHANGED
|
@@ -782,14 +782,14 @@ const File = ({
|
|
|
782
782
|
change({
|
|
783
783
|
file: file[ix],
|
|
784
784
|
uuid: v4(),
|
|
785
|
-
check: formatError
|
|
785
|
+
check: formatError ? formatError : configStyles.FILE.formatError
|
|
786
786
|
});
|
|
787
787
|
}
|
|
788
788
|
} else {
|
|
789
789
|
change({
|
|
790
790
|
file: file[ix],
|
|
791
791
|
uuid: v4(),
|
|
792
|
-
check: maxSizeError
|
|
792
|
+
check: maxSizeError ? maxSizeError : configStyles.FILE.maxSizeError
|
|
793
793
|
});
|
|
794
794
|
}
|
|
795
795
|
}
|
|
@@ -811,14 +811,14 @@ const File = ({
|
|
|
811
811
|
change({
|
|
812
812
|
file: file[ix],
|
|
813
813
|
uuid: v4(),
|
|
814
|
-
check: formatError
|
|
814
|
+
check: formatError ? formatError : configStyles.FILE.formatError
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
817
|
} else {
|
|
818
818
|
change({
|
|
819
819
|
file: file[ix],
|
|
820
820
|
uuid: v4(),
|
|
821
|
-
check: maxSizeError
|
|
821
|
+
check: maxSizeError ? maxSizeError : configStyles.FILE.maxSizeError
|
|
822
822
|
});
|
|
823
823
|
}
|
|
824
824
|
}
|
|
@@ -832,7 +832,7 @@ const File = ({
|
|
|
832
832
|
setImage(null);
|
|
833
833
|
handleUploadFiles(file);
|
|
834
834
|
if (file.length === 0 && memoizedItems.length === 0) {
|
|
835
|
-
setError(noChoosenFile);
|
|
835
|
+
setError(noChoosenFile ? noChoosenFile : configStyles.FILE.noChoosenFile);
|
|
836
836
|
}
|
|
837
837
|
} else {
|
|
838
838
|
if (file[0]) {
|
|
@@ -850,16 +850,16 @@ const File = ({
|
|
|
850
850
|
}
|
|
851
851
|
} else {
|
|
852
852
|
setImage(null);
|
|
853
|
-
setError(formatError);
|
|
853
|
+
setError(formatError ? formatError : configStyles.FILE.formatError);
|
|
854
854
|
}
|
|
855
855
|
} else {
|
|
856
856
|
setImage(null);
|
|
857
|
-
setError(maxSizeError);
|
|
857
|
+
setError(maxSizeError ? maxSizeError : configStyles.FILE.maxSizeError);
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
if (file.length === 0) {
|
|
861
861
|
setImage(null);
|
|
862
|
-
setError(noChoosenFile);
|
|
862
|
+
setError(noChoosenFile ? noChoosenFile : configStyles.FILE.noChoosenFile);
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
};
|
|
@@ -2492,13 +2492,14 @@ const Modal = ({
|
|
|
2492
2492
|
outsideClose,
|
|
2493
2493
|
headerWeight,
|
|
2494
2494
|
headerHeight,
|
|
2495
|
-
imageMaxWidth,
|
|
2495
|
+
// imageMaxWidth,
|
|
2496
2496
|
justifyContent,
|
|
2497
|
-
imageWrapWidth,
|
|
2497
|
+
// imageWrapWidth,
|
|
2498
2498
|
backgroundColor,
|
|
2499
2499
|
imageWrapHeight,
|
|
2500
2500
|
grayDecorHeight,
|
|
2501
|
-
layerBackgroundColor
|
|
2501
|
+
layerBackgroundColor,
|
|
2502
|
+
closeAreaBackgroundColor
|
|
2502
2503
|
}) => {
|
|
2503
2504
|
const [select, setSelect] = useState(0);
|
|
2504
2505
|
const [isHover, setIsHover] = useState(false);
|
|
@@ -2668,7 +2669,7 @@ const Modal = ({
|
|
|
2668
2669
|
borderTopLeftRadius: '6px',
|
|
2669
2670
|
borderTopRightRadius: '6px',
|
|
2670
2671
|
height: grayDecorHeight ? grayDecorHeight : configStyles.MODAL.grayDecorHeight,
|
|
2671
|
-
|
|
2672
|
+
background: closeAreaBackgroundColor ? closeAreaBackgroundColor : configStyles.MODAL.closeAreaBackgroundColor
|
|
2672
2673
|
}
|
|
2673
2674
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
2674
2675
|
onClick: handleCloseModal,
|
|
@@ -2687,7 +2688,6 @@ const Modal = ({
|
|
|
2687
2688
|
}
|
|
2688
2689
|
}, /*#__PURE__*/React__default.createElement(SvgCloseSlide, null))), /*#__PURE__*/React__default.createElement("div", {
|
|
2689
2690
|
style: {
|
|
2690
|
-
width: imageWrapWidth ? imageWrapWidth : configStyles.MODAL.imageWrapWidth,
|
|
2691
2691
|
height: imageWrapHeight ? imageWrapHeight : configStyles.MODAL.imageWrapHeight
|
|
2692
2692
|
}
|
|
2693
2693
|
}, innerData && innerData.length > 0 && innerData.map((item, index) => {
|
|
@@ -2700,13 +2700,12 @@ const Modal = ({
|
|
|
2700
2700
|
}, /*#__PURE__*/React__default.createElement("img", {
|
|
2701
2701
|
style: {
|
|
2702
2702
|
display: 'block',
|
|
2703
|
-
objectFit: '
|
|
2704
|
-
objectPosition: 'center',
|
|
2703
|
+
objectFit: 'contain',
|
|
2705
2704
|
margin: imageMargin ? imageMargin : configStyles.MODAL.imageMargin,
|
|
2706
2705
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
2707
2706
|
width: imageWidth ? imageWidth : configStyles.MODAL.imageWidth,
|
|
2708
|
-
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
2709
|
-
maxWidth:
|
|
2707
|
+
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
2708
|
+
// maxWidth: '100%'
|
|
2710
2709
|
},
|
|
2711
2710
|
src: item.url
|
|
2712
2711
|
}), isHover && showZoomIcon ? /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2794,7 +2793,8 @@ Modal.propTypes = {
|
|
|
2794
2793
|
backgroundColor: PropTypes.string,
|
|
2795
2794
|
grayDecorHeight: PropTypes.string,
|
|
2796
2795
|
imageWrapHeight: PropTypes.string,
|
|
2797
|
-
layerBackgroundColor: PropTypes.string
|
|
2796
|
+
layerBackgroundColor: PropTypes.string,
|
|
2797
|
+
closeAreaBackgroundColor: PropTypes.string
|
|
2798
2798
|
};
|
|
2799
2799
|
Modal.defaultProps = {
|
|
2800
2800
|
type: 'content'
|
|
@@ -2877,6 +2877,7 @@ const Input = ({
|
|
|
2877
2877
|
const [show, setShow] = useState(false);
|
|
2878
2878
|
const [isHover, setIsHover] = useState(false);
|
|
2879
2879
|
const [innerValue, setInnerValue] = useState('');
|
|
2880
|
+
const [innerMinNumSize, setInnerMinNumSize] = useState(0);
|
|
2880
2881
|
const [innerErrorMessage, setInnerErrorMessage] = useState('');
|
|
2881
2882
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
2882
2883
|
const configStyles = compereConfigs();
|
|
@@ -2912,60 +2913,60 @@ const Input = ({
|
|
|
2912
2913
|
}
|
|
2913
2914
|
return val;
|
|
2914
2915
|
};
|
|
2915
|
-
const handleCheckTypeNumber = val => {
|
|
2916
|
+
const handleCheckTypeNumber = (val, prevVal) => {
|
|
2916
2917
|
if (type === 'number') {
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
} else if (float[1] !== undefined && float[1] !== '0') {
|
|
2948
|
-
if (float[2] === undefined || float[2] === '0') {
|
|
2949
|
-
val = `${int}.${float[0]}${float[1]}`;
|
|
2950
|
-
} else if (float[2] !== undefined && float[2] !== '0') {
|
|
2951
|
-
val = `${int}.${float[0]}${float[1]}${float[2]}`;
|
|
2918
|
+
if (maxLength && maxLength > 0) {
|
|
2919
|
+
if (val.length > maxLength) {
|
|
2920
|
+
val = val.substr(0, maxLength);
|
|
2921
|
+
}
|
|
2922
|
+
} else {
|
|
2923
|
+
const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
|
|
2924
|
+
if (val.length > 16 && !val.includes('.')) {
|
|
2925
|
+
val = val.substr(0, 16);
|
|
2926
|
+
}
|
|
2927
|
+
if (val > Number.MAX_SAFE_INTEGER) {
|
|
2928
|
+
val = prevVal;
|
|
2929
|
+
}
|
|
2930
|
+
if (val < Number.MIN_SAFE_INTEGER) {
|
|
2931
|
+
val = prevVal;
|
|
2932
|
+
}
|
|
2933
|
+
if (innerMinNumSize && val < innerMinNumSize) {
|
|
2934
|
+
val = prevVal;
|
|
2935
|
+
}
|
|
2936
|
+
if (maxNumSize && val > maxNumSize) {
|
|
2937
|
+
val = prevVal;
|
|
2938
|
+
}
|
|
2939
|
+
if (floatToFix > 0) {
|
|
2940
|
+
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
2941
|
+
const int = floatNumParts[0];
|
|
2942
|
+
const float = floatNumParts[1];
|
|
2943
|
+
if (float && float.length > 0) {
|
|
2944
|
+
let floatResult = '';
|
|
2945
|
+
[...float].map((item, index) => {
|
|
2946
|
+
if (index + 1 <= floatToFix) {
|
|
2947
|
+
floatResult += item;
|
|
2952
2948
|
}
|
|
2949
|
+
});
|
|
2950
|
+
if (floatResult !== '') {
|
|
2951
|
+
val = `${int}.${floatResult}`;
|
|
2952
|
+
} else {
|
|
2953
|
+
val = `${int}`;
|
|
2953
2954
|
}
|
|
2954
2955
|
}
|
|
2956
|
+
} else {
|
|
2957
|
+
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
2958
|
+
const int = floatNumParts[0];
|
|
2959
|
+
if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
|
|
2960
|
+
val = `${int}`;
|
|
2961
|
+
}
|
|
2955
2962
|
}
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
val =
|
|
2963
|
+
if (!regNum.test(val)) {
|
|
2964
|
+
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2965
|
+
return b + c.replace(/\./g, '');
|
|
2966
|
+
});
|
|
2967
|
+
val = newStr;
|
|
2961
2968
|
}
|
|
2962
2969
|
}
|
|
2963
|
-
if (!regNum.test(val)) {
|
|
2964
|
-
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2965
|
-
return b + c.replace(/\./g, '');
|
|
2966
|
-
});
|
|
2967
|
-
val = newStr;
|
|
2968
|
-
}
|
|
2969
2970
|
if (withoutDot && !/^\d+$/.test(val)) {
|
|
2970
2971
|
const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2971
2972
|
return b + c.replace(/\./g, '');
|
|
@@ -2978,9 +2979,9 @@ const Input = ({
|
|
|
2978
2979
|
const handleChange = event => {
|
|
2979
2980
|
let prevValue = innerValue;
|
|
2980
2981
|
let currentValue = event.target.value;
|
|
2981
|
-
const max = maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
2982
|
+
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
2982
2983
|
currentValue = handleCheckTypeTel(currentValue, prevValue);
|
|
2983
|
-
currentValue = handleCheckTypeNumber(currentValue);
|
|
2984
|
+
currentValue = handleCheckTypeNumber(currentValue, prevValue);
|
|
2984
2985
|
if (max && currentValue.length > max && type !== 'tel' && type !== 'number') {
|
|
2985
2986
|
currentValue = currentValue.substr(0, max);
|
|
2986
2987
|
}
|
|
@@ -3002,29 +3003,41 @@ const Input = ({
|
|
|
3002
3003
|
setShow(!show);
|
|
3003
3004
|
};
|
|
3004
3005
|
useEffect(() => {
|
|
3006
|
+
let newValue = value;
|
|
3005
3007
|
if (errorMessage) {
|
|
3006
3008
|
setInnerErrorMessage(errorMessage);
|
|
3007
3009
|
} else {
|
|
3008
3010
|
setInnerErrorMessage('');
|
|
3009
3011
|
}
|
|
3010
|
-
|
|
3012
|
+
if (minNumSize && minNumSize < 0) {
|
|
3013
|
+
setInnerMinNumSize(0);
|
|
3014
|
+
alert("minNumSize prop can't be less then 0");
|
|
3015
|
+
} else if (minNumSize && minNumSize >= 0) {
|
|
3016
|
+
setInnerMinNumSize(minNumSize);
|
|
3017
|
+
}
|
|
3018
|
+
if (type === 'number' && (maxNumSize || maxNumSize === 0 || minNumSize || minNumSize === 0) && (maxLength || maxLength === 0)) {
|
|
3019
|
+
alert("You can't use maxNumSize or minNumSize and maxLength props together when Input type is number");
|
|
3020
|
+
}
|
|
3021
|
+
if (type === 'number' && maxNumSize < minNumSize) {
|
|
3022
|
+
alert("maxNumSize prop can't be less then minNumSize");
|
|
3023
|
+
}
|
|
3011
3024
|
if (value !== undefined) {
|
|
3012
3025
|
if (value === null) {
|
|
3013
3026
|
newValue = '';
|
|
3014
3027
|
} else {
|
|
3015
|
-
const max = maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
3016
|
-
newValue = handleCheckTypeTel(
|
|
3017
|
-
newValue = handleCheckTypeNumber(value);
|
|
3028
|
+
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
3029
|
+
newValue = handleCheckTypeTel(value, newValue);
|
|
3030
|
+
newValue = handleCheckTypeNumber(value, newValue);
|
|
3018
3031
|
if (max && value.length > max && type !== 'tel' && type !== 'number') {
|
|
3019
3032
|
newValue = value.substr(0, max);
|
|
3020
3033
|
}
|
|
3021
3034
|
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3022
3035
|
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3023
3036
|
}
|
|
3024
|
-
setInnerValue(() => newValue);
|
|
3025
3037
|
}
|
|
3026
3038
|
}
|
|
3027
|
-
|
|
3039
|
+
setInnerValue(() => newValue);
|
|
3040
|
+
}, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage, telErrorMessage]);
|
|
3028
3041
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3029
3042
|
className: classProps
|
|
3030
3043
|
}, label ? /*#__PURE__*/React__default.createElement("label", {
|
package/dist/index.js
CHANGED
|
@@ -812,14 +812,14 @@ const File = ({
|
|
|
812
812
|
change({
|
|
813
813
|
file: file[ix],
|
|
814
814
|
uuid: v4(),
|
|
815
|
-
check: formatError
|
|
815
|
+
check: formatError ? formatError : configStyles.FILE.formatError
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
818
|
} else {
|
|
819
819
|
change({
|
|
820
820
|
file: file[ix],
|
|
821
821
|
uuid: v4(),
|
|
822
|
-
check: maxSizeError
|
|
822
|
+
check: maxSizeError ? maxSizeError : configStyles.FILE.maxSizeError
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
}
|
|
@@ -841,14 +841,14 @@ const File = ({
|
|
|
841
841
|
change({
|
|
842
842
|
file: file[ix],
|
|
843
843
|
uuid: v4(),
|
|
844
|
-
check: formatError
|
|
844
|
+
check: formatError ? formatError : configStyles.FILE.formatError
|
|
845
845
|
});
|
|
846
846
|
}
|
|
847
847
|
} else {
|
|
848
848
|
change({
|
|
849
849
|
file: file[ix],
|
|
850
850
|
uuid: v4(),
|
|
851
|
-
check: maxSizeError
|
|
851
|
+
check: maxSizeError ? maxSizeError : configStyles.FILE.maxSizeError
|
|
852
852
|
});
|
|
853
853
|
}
|
|
854
854
|
}
|
|
@@ -862,7 +862,7 @@ const File = ({
|
|
|
862
862
|
setImage(null);
|
|
863
863
|
handleUploadFiles(file);
|
|
864
864
|
if (file.length === 0 && memoizedItems.length === 0) {
|
|
865
|
-
setError(noChoosenFile);
|
|
865
|
+
setError(noChoosenFile ? noChoosenFile : configStyles.FILE.noChoosenFile);
|
|
866
866
|
}
|
|
867
867
|
} else {
|
|
868
868
|
if (file[0]) {
|
|
@@ -880,16 +880,16 @@ const File = ({
|
|
|
880
880
|
}
|
|
881
881
|
} else {
|
|
882
882
|
setImage(null);
|
|
883
|
-
setError(formatError);
|
|
883
|
+
setError(formatError ? formatError : configStyles.FILE.formatError);
|
|
884
884
|
}
|
|
885
885
|
} else {
|
|
886
886
|
setImage(null);
|
|
887
|
-
setError(maxSizeError);
|
|
887
|
+
setError(maxSizeError ? maxSizeError : configStyles.FILE.maxSizeError);
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
890
|
if (file.length === 0) {
|
|
891
891
|
setImage(null);
|
|
892
|
-
setError(noChoosenFile);
|
|
892
|
+
setError(noChoosenFile ? noChoosenFile : configStyles.FILE.noChoosenFile);
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
895
|
};
|
|
@@ -2522,13 +2522,14 @@ const Modal = ({
|
|
|
2522
2522
|
outsideClose,
|
|
2523
2523
|
headerWeight,
|
|
2524
2524
|
headerHeight,
|
|
2525
|
-
imageMaxWidth,
|
|
2525
|
+
// imageMaxWidth,
|
|
2526
2526
|
justifyContent,
|
|
2527
|
-
imageWrapWidth,
|
|
2527
|
+
// imageWrapWidth,
|
|
2528
2528
|
backgroundColor,
|
|
2529
2529
|
imageWrapHeight,
|
|
2530
2530
|
grayDecorHeight,
|
|
2531
|
-
layerBackgroundColor
|
|
2531
|
+
layerBackgroundColor,
|
|
2532
|
+
closeAreaBackgroundColor
|
|
2532
2533
|
}) => {
|
|
2533
2534
|
const [select, setSelect] = React.useState(0);
|
|
2534
2535
|
const [isHover, setIsHover] = React.useState(false);
|
|
@@ -2698,7 +2699,7 @@ const Modal = ({
|
|
|
2698
2699
|
borderTopLeftRadius: '6px',
|
|
2699
2700
|
borderTopRightRadius: '6px',
|
|
2700
2701
|
height: grayDecorHeight ? grayDecorHeight : configStyles.MODAL.grayDecorHeight,
|
|
2701
|
-
|
|
2702
|
+
background: closeAreaBackgroundColor ? closeAreaBackgroundColor : configStyles.MODAL.closeAreaBackgroundColor
|
|
2702
2703
|
}
|
|
2703
2704
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
2704
2705
|
onClick: handleCloseModal,
|
|
@@ -2717,7 +2718,6 @@ const Modal = ({
|
|
|
2717
2718
|
}
|
|
2718
2719
|
}, /*#__PURE__*/React__default["default"].createElement(SvgCloseSlide, null))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2719
2720
|
style: {
|
|
2720
|
-
width: imageWrapWidth ? imageWrapWidth : configStyles.MODAL.imageWrapWidth,
|
|
2721
2721
|
height: imageWrapHeight ? imageWrapHeight : configStyles.MODAL.imageWrapHeight
|
|
2722
2722
|
}
|
|
2723
2723
|
}, innerData && innerData.length > 0 && innerData.map((item, index) => {
|
|
@@ -2730,13 +2730,12 @@ const Modal = ({
|
|
|
2730
2730
|
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
2731
2731
|
style: {
|
|
2732
2732
|
display: 'block',
|
|
2733
|
-
objectFit: '
|
|
2734
|
-
objectPosition: 'center',
|
|
2733
|
+
objectFit: 'contain',
|
|
2735
2734
|
margin: imageMargin ? imageMargin : configStyles.MODAL.imageMargin,
|
|
2736
2735
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
2737
2736
|
width: imageWidth ? imageWidth : configStyles.MODAL.imageWidth,
|
|
2738
|
-
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
2739
|
-
maxWidth:
|
|
2737
|
+
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
2738
|
+
// maxWidth: '100%'
|
|
2740
2739
|
},
|
|
2741
2740
|
src: item.url
|
|
2742
2741
|
}), isHover && showZoomIcon ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -2824,7 +2823,8 @@ Modal.propTypes = {
|
|
|
2824
2823
|
backgroundColor: PropTypes__default["default"].string,
|
|
2825
2824
|
grayDecorHeight: PropTypes__default["default"].string,
|
|
2826
2825
|
imageWrapHeight: PropTypes__default["default"].string,
|
|
2827
|
-
layerBackgroundColor: PropTypes__default["default"].string
|
|
2826
|
+
layerBackgroundColor: PropTypes__default["default"].string,
|
|
2827
|
+
closeAreaBackgroundColor: PropTypes__default["default"].string
|
|
2828
2828
|
};
|
|
2829
2829
|
Modal.defaultProps = {
|
|
2830
2830
|
type: 'content'
|
|
@@ -2907,6 +2907,7 @@ const Input = ({
|
|
|
2907
2907
|
const [show, setShow] = React.useState(false);
|
|
2908
2908
|
const [isHover, setIsHover] = React.useState(false);
|
|
2909
2909
|
const [innerValue, setInnerValue] = React.useState('');
|
|
2910
|
+
const [innerMinNumSize, setInnerMinNumSize] = React.useState(0);
|
|
2910
2911
|
const [innerErrorMessage, setInnerErrorMessage] = React.useState('');
|
|
2911
2912
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
2912
2913
|
const configStyles = compereConfigs();
|
|
@@ -2942,60 +2943,60 @@ const Input = ({
|
|
|
2942
2943
|
}
|
|
2943
2944
|
return val;
|
|
2944
2945
|
};
|
|
2945
|
-
const handleCheckTypeNumber = val => {
|
|
2946
|
+
const handleCheckTypeNumber = (val, prevVal) => {
|
|
2946
2947
|
if (type === 'number') {
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
} else if (float[1] !== undefined && float[1] !== '0') {
|
|
2978
|
-
if (float[2] === undefined || float[2] === '0') {
|
|
2979
|
-
val = `${int}.${float[0]}${float[1]}`;
|
|
2980
|
-
} else if (float[2] !== undefined && float[2] !== '0') {
|
|
2981
|
-
val = `${int}.${float[0]}${float[1]}${float[2]}`;
|
|
2948
|
+
if (maxLength && maxLength > 0) {
|
|
2949
|
+
if (val.length > maxLength) {
|
|
2950
|
+
val = val.substr(0, maxLength);
|
|
2951
|
+
}
|
|
2952
|
+
} else {
|
|
2953
|
+
const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
|
|
2954
|
+
if (val.length > 16 && !val.includes('.')) {
|
|
2955
|
+
val = val.substr(0, 16);
|
|
2956
|
+
}
|
|
2957
|
+
if (val > Number.MAX_SAFE_INTEGER) {
|
|
2958
|
+
val = prevVal;
|
|
2959
|
+
}
|
|
2960
|
+
if (val < Number.MIN_SAFE_INTEGER) {
|
|
2961
|
+
val = prevVal;
|
|
2962
|
+
}
|
|
2963
|
+
if (innerMinNumSize && val < innerMinNumSize) {
|
|
2964
|
+
val = prevVal;
|
|
2965
|
+
}
|
|
2966
|
+
if (maxNumSize && val > maxNumSize) {
|
|
2967
|
+
val = prevVal;
|
|
2968
|
+
}
|
|
2969
|
+
if (floatToFix > 0) {
|
|
2970
|
+
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
2971
|
+
const int = floatNumParts[0];
|
|
2972
|
+
const float = floatNumParts[1];
|
|
2973
|
+
if (float && float.length > 0) {
|
|
2974
|
+
let floatResult = '';
|
|
2975
|
+
[...float].map((item, index) => {
|
|
2976
|
+
if (index + 1 <= floatToFix) {
|
|
2977
|
+
floatResult += item;
|
|
2982
2978
|
}
|
|
2979
|
+
});
|
|
2980
|
+
if (floatResult !== '') {
|
|
2981
|
+
val = `${int}.${floatResult}`;
|
|
2982
|
+
} else {
|
|
2983
|
+
val = `${int}`;
|
|
2983
2984
|
}
|
|
2984
2985
|
}
|
|
2986
|
+
} else {
|
|
2987
|
+
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
2988
|
+
const int = floatNumParts[0];
|
|
2989
|
+
if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
|
|
2990
|
+
val = `${int}`;
|
|
2991
|
+
}
|
|
2985
2992
|
}
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
val =
|
|
2993
|
+
if (!regNum.test(val)) {
|
|
2994
|
+
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2995
|
+
return b + c.replace(/\./g, '');
|
|
2996
|
+
});
|
|
2997
|
+
val = newStr;
|
|
2991
2998
|
}
|
|
2992
2999
|
}
|
|
2993
|
-
if (!regNum.test(val)) {
|
|
2994
|
-
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2995
|
-
return b + c.replace(/\./g, '');
|
|
2996
|
-
});
|
|
2997
|
-
val = newStr;
|
|
2998
|
-
}
|
|
2999
3000
|
if (withoutDot && !/^\d+$/.test(val)) {
|
|
3000
3001
|
const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3001
3002
|
return b + c.replace(/\./g, '');
|
|
@@ -3008,9 +3009,9 @@ const Input = ({
|
|
|
3008
3009
|
const handleChange = event => {
|
|
3009
3010
|
let prevValue = innerValue;
|
|
3010
3011
|
let currentValue = event.target.value;
|
|
3011
|
-
const max = maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
3012
|
+
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
3012
3013
|
currentValue = handleCheckTypeTel(currentValue, prevValue);
|
|
3013
|
-
currentValue = handleCheckTypeNumber(currentValue);
|
|
3014
|
+
currentValue = handleCheckTypeNumber(currentValue, prevValue);
|
|
3014
3015
|
if (max && currentValue.length > max && type !== 'tel' && type !== 'number') {
|
|
3015
3016
|
currentValue = currentValue.substr(0, max);
|
|
3016
3017
|
}
|
|
@@ -3032,29 +3033,41 @@ const Input = ({
|
|
|
3032
3033
|
setShow(!show);
|
|
3033
3034
|
};
|
|
3034
3035
|
React.useEffect(() => {
|
|
3036
|
+
let newValue = value;
|
|
3035
3037
|
if (errorMessage) {
|
|
3036
3038
|
setInnerErrorMessage(errorMessage);
|
|
3037
3039
|
} else {
|
|
3038
3040
|
setInnerErrorMessage('');
|
|
3039
3041
|
}
|
|
3040
|
-
|
|
3042
|
+
if (minNumSize && minNumSize < 0) {
|
|
3043
|
+
setInnerMinNumSize(0);
|
|
3044
|
+
alert("minNumSize prop can't be less then 0");
|
|
3045
|
+
} else if (minNumSize && minNumSize >= 0) {
|
|
3046
|
+
setInnerMinNumSize(minNumSize);
|
|
3047
|
+
}
|
|
3048
|
+
if (type === 'number' && (maxNumSize || maxNumSize === 0 || minNumSize || minNumSize === 0) && (maxLength || maxLength === 0)) {
|
|
3049
|
+
alert("You can't use maxNumSize or minNumSize and maxLength props together when Input type is number");
|
|
3050
|
+
}
|
|
3051
|
+
if (type === 'number' && maxNumSize < minNumSize) {
|
|
3052
|
+
alert("maxNumSize prop can't be less then minNumSize");
|
|
3053
|
+
}
|
|
3041
3054
|
if (value !== undefined) {
|
|
3042
3055
|
if (value === null) {
|
|
3043
3056
|
newValue = '';
|
|
3044
3057
|
} else {
|
|
3045
|
-
const max = maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
3046
|
-
newValue = handleCheckTypeTel(
|
|
3047
|
-
newValue = handleCheckTypeNumber(value);
|
|
3058
|
+
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : configStyles.INPUT.maxLength;
|
|
3059
|
+
newValue = handleCheckTypeTel(value, newValue);
|
|
3060
|
+
newValue = handleCheckTypeNumber(value, newValue);
|
|
3048
3061
|
if (max && value.length > max && type !== 'tel' && type !== 'number') {
|
|
3049
3062
|
newValue = value.substr(0, max);
|
|
3050
3063
|
}
|
|
3051
3064
|
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3052
3065
|
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3053
3066
|
}
|
|
3054
|
-
setInnerValue(() => newValue);
|
|
3055
3067
|
}
|
|
3056
3068
|
}
|
|
3057
|
-
|
|
3069
|
+
setInnerValue(() => newValue);
|
|
3070
|
+
}, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage, telErrorMessage]);
|
|
3058
3071
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3059
3072
|
className: classProps
|
|
3060
3073
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
package/package.json
CHANGED
package/tui.config.js
CHANGED
|
@@ -413,8 +413,8 @@ module.exports = {
|
|
|
413
413
|
imageWidth: '', // for modal image width on images mode
|
|
414
414
|
headerHeight: '30px', // for modal header height
|
|
415
415
|
grayDecorHeight: '80px', // for modal top decoration when show slider
|
|
416
|
-
width: '
|
|
417
|
-
height: '
|
|
416
|
+
width: '', // for modal width
|
|
417
|
+
height: '', // for modal width
|
|
418
418
|
headerColor: '#00236a', // for modal header color
|
|
419
419
|
backgroundColor: 'white', // for modal background color
|
|
420
420
|
padding: '20px 20px 20px', // for modal padding
|
|
@@ -424,8 +424,9 @@ module.exports = {
|
|
|
424
424
|
borderColor: 'transparent', // for modal border color
|
|
425
425
|
imageMargin: '0px', // for image margin
|
|
426
426
|
imageMaxWidth: '100%', // for image max width
|
|
427
|
-
imageWrapHeight: '
|
|
427
|
+
imageWrapHeight: '100%', // for image wrap
|
|
428
428
|
imageWrapWidth: '100%', // for image wrap
|
|
429
|
+
closeAreaBackgroundColor: 'linear-gradient(to bottom, rgb(60, 57, 62), rgba(60, 57, 62, 0))' // for close div background color
|
|
429
430
|
},
|
|
430
431
|
// default properties for <Checkbox /> component
|
|
431
432
|
CHECKBOX: {
|