sapo-components-ui-rn 1.0.74 → 1.0.76
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/components/Text/index.d.ts +1 -0
- package/dist/index.esm.js +123 -66
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +123 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +9 -8
- package/src/components/ButtonIcon/index.tsx +6 -5
- package/src/components/NumberKeyboard/index.tsx +61 -46
- package/src/components/Text/index.tsx +9 -4
- package/src/components/TextInput/TextInputDefault.tsx +6 -1
- package/src/components/TextInput/TextInputFlat.tsx +6 -1
- package/src/components/TextInput/TextInputNumber.tsx +39 -21
- package/src/theme/container-styles.tsx +24 -24
package/dist/index.esm.js
CHANGED
|
@@ -4911,18 +4911,24 @@ var memoWithRef = function (component) {
|
|
|
4911
4911
|
var Text = function (props) {
|
|
4912
4912
|
var children = props.children, onPress = props.onPress; props.theme; var rest = __rest(props, ["children", "onPress", "theme"]);
|
|
4913
4913
|
var theme = useInternalTheme();
|
|
4914
|
+
var colors = theme.colors;
|
|
4914
4915
|
delete rest.style;
|
|
4915
4916
|
var _getStyle = function () {
|
|
4916
4917
|
var style = {
|
|
4917
4918
|
fontWeight: "normal",
|
|
4918
|
-
color: colors.
|
|
4919
|
+
color: colors.textDefault,
|
|
4919
4920
|
fontFamily: "Inter-Regular",
|
|
4921
|
+
fontSize: 14,
|
|
4922
|
+
lineHeight: 20,
|
|
4920
4923
|
};
|
|
4921
|
-
var _a = props.size, size = _a === void 0 ? 14 : _a, center = props.center, color = props.color, bold = props.bold, medium = props.medium;
|
|
4924
|
+
var _a = props.size, size = _a === void 0 ? 14 : _a, lineHeight = props.lineHeight, center = props.center, color = props.color, bold = props.bold, medium = props.medium;
|
|
4922
4925
|
style.color = theme.colors.textDefault || "black";
|
|
4923
4926
|
if (size) {
|
|
4924
4927
|
style.fontSize = size;
|
|
4925
4928
|
}
|
|
4929
|
+
if (lineHeight) {
|
|
4930
|
+
style.lineHeight = lineHeight;
|
|
4931
|
+
}
|
|
4926
4932
|
if (color) {
|
|
4927
4933
|
style.color = color;
|
|
4928
4934
|
}
|
|
@@ -5252,7 +5258,13 @@ var TextInputFlat = function (_a) {
|
|
|
5252
5258
|
var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.editable, editable = _c === void 0 ? true : _c, label = _a.label, _d = _a.error, error = _d === void 0 ? false : _d, customSelectionColor = _a.selectionColor, cursorColor = _a.cursorColor, underlineColor = _a.underlineColor; _a.underlineStyle; var activeUnderlineColor = _a.activeUnderlineColor, textColor = _a.textColor, dense = _a.dense, style = _a.style, theme = _a.theme, _e = _a.render, render = _e === void 0 ? function (props) { return React$3.createElement(TextInput$1, __assign({}, props)); } : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, parentState = _a.parentState, innerRef = _a.innerRef, onFocus = _a.onFocus; _a.forceFocus; var onBlur = _a.onBlur, onChangeText = _a.onChangeText, onLayoutAnimatedText = _a.onLayoutAnimatedText, onLabelTextLayout = _a.onLabelTextLayout; _a.onLeftAffixLayoutChange; _a.onRightAffixLayoutChange; var onInputLayout = _a.onInputLayout, left = _a.left, right = _a.right, prefix = _a.prefix, suffix = _a.suffix, placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, contentStyle = _a.contentStyle, scaledLabel = _a.scaledLabel, outlineStyle = _a.outlineStyle, outlineColor = _a.outlineColor, value = _a.value, textError = _a.textError, required = _a.required, rest = __rest(_a, ["disabled", "editable", "label", "error", "selectionColor", "cursorColor", "underlineColor", "underlineStyle", "activeUnderlineColor", "textColor", "dense", "style", "theme", "render", "multiline", "parentState", "innerRef", "onFocus", "forceFocus", "onBlur", "onChangeText", "onLayoutAnimatedText", "onLabelTextLayout", "onLeftAffixLayoutChange", "onRightAffixLayoutChange", "onInputLayout", "left", "right", "prefix", "suffix", "placeholderTextColor", "clearButton", "contentStyle", "scaledLabel", "outlineStyle", "outlineColor", "value", "textError", "required"]);
|
|
5253
5259
|
var _g = React$3.useState(value || ""), inputValue = _g[0], setInputValue = _g[1];
|
|
5254
5260
|
React$3.useEffect(function () {
|
|
5255
|
-
|
|
5261
|
+
if (value === undefined) {
|
|
5262
|
+
setInputValue("");
|
|
5263
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText("");
|
|
5264
|
+
}
|
|
5265
|
+
else {
|
|
5266
|
+
setInputValue(value || "");
|
|
5267
|
+
}
|
|
5256
5268
|
}, [value]);
|
|
5257
5269
|
var handleChangeText = function (text) {
|
|
5258
5270
|
setInputValue(text);
|
|
@@ -5572,7 +5584,13 @@ var TextInputDefault = function (_a) {
|
|
|
5572
5584
|
}), inputTextColor = _o.inputTextColor, activeColor = _o.activeColor, selectionColor = _o.selectionColor;
|
|
5573
5585
|
var _p = React$3.useState(value || ""), inputValue = _p[0], setInputValue = _p[1];
|
|
5574
5586
|
React$3.useEffect(function () {
|
|
5575
|
-
|
|
5587
|
+
if (value === undefined) {
|
|
5588
|
+
setInputValue("");
|
|
5589
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText("");
|
|
5590
|
+
}
|
|
5591
|
+
else {
|
|
5592
|
+
setInputValue(value || "");
|
|
5593
|
+
}
|
|
5576
5594
|
}, [value]);
|
|
5577
5595
|
var handleChangeText = function (text) {
|
|
5578
5596
|
setInputValue(text);
|
|
@@ -5840,52 +5858,52 @@ var containerStyles = StyleSheet.create({
|
|
|
5840
5858
|
},
|
|
5841
5859
|
//MARK: text size
|
|
5842
5860
|
text10: {
|
|
5843
|
-
fontSize: 10
|
|
5844
|
-
lineHeight: 12
|
|
5861
|
+
fontSize: 10,
|
|
5862
|
+
lineHeight: 12,
|
|
5845
5863
|
},
|
|
5846
5864
|
text12: {
|
|
5847
|
-
fontSize: 12
|
|
5848
|
-
lineHeight: 16
|
|
5865
|
+
fontSize: 12,
|
|
5866
|
+
lineHeight: 16,
|
|
5849
5867
|
},
|
|
5850
5868
|
text14: {
|
|
5851
|
-
fontSize: 14
|
|
5852
|
-
lineHeight: 20
|
|
5869
|
+
fontSize: 14,
|
|
5870
|
+
lineHeight: 20,
|
|
5853
5871
|
},
|
|
5854
5872
|
text16: {
|
|
5855
|
-
fontSize: 16
|
|
5856
|
-
lineHeight: 24
|
|
5873
|
+
fontSize: 16,
|
|
5874
|
+
lineHeight: 24,
|
|
5857
5875
|
},
|
|
5858
5876
|
text18: {
|
|
5859
|
-
fontSize: 18
|
|
5860
|
-
lineHeight: 28
|
|
5877
|
+
fontSize: 18,
|
|
5878
|
+
lineHeight: 28,
|
|
5861
5879
|
},
|
|
5862
5880
|
text20: {
|
|
5863
|
-
fontSize: 20
|
|
5864
|
-
lineHeight: 28
|
|
5881
|
+
fontSize: 20,
|
|
5882
|
+
lineHeight: 28,
|
|
5865
5883
|
},
|
|
5866
5884
|
text22: {
|
|
5867
|
-
fontSize: 22
|
|
5868
|
-
lineHeight: 30
|
|
5885
|
+
fontSize: 22,
|
|
5886
|
+
lineHeight: 30,
|
|
5869
5887
|
},
|
|
5870
5888
|
text24: {
|
|
5871
|
-
fontSize: 24
|
|
5872
|
-
lineHeight: 32
|
|
5889
|
+
fontSize: 24,
|
|
5890
|
+
lineHeight: 32,
|
|
5873
5891
|
},
|
|
5874
5892
|
text26: {
|
|
5875
|
-
fontSize: 26
|
|
5876
|
-
lineHeight: 34
|
|
5893
|
+
fontSize: 26,
|
|
5894
|
+
lineHeight: 34,
|
|
5877
5895
|
},
|
|
5878
5896
|
text28: {
|
|
5879
|
-
fontSize: 28
|
|
5880
|
-
lineHeight: 36
|
|
5897
|
+
fontSize: 28,
|
|
5898
|
+
lineHeight: 36,
|
|
5881
5899
|
},
|
|
5882
5900
|
text30: {
|
|
5883
|
-
fontSize: 30
|
|
5884
|
-
lineHeight: 38
|
|
5901
|
+
fontSize: 30,
|
|
5902
|
+
lineHeight: 38,
|
|
5885
5903
|
},
|
|
5886
5904
|
text32: {
|
|
5887
|
-
fontSize: 32
|
|
5888
|
-
lineHeight: 40
|
|
5905
|
+
fontSize: 32,
|
|
5906
|
+
lineHeight: 40,
|
|
5889
5907
|
},
|
|
5890
5908
|
//MARK:fonts
|
|
5891
5909
|
textRegular: {
|
|
@@ -5908,12 +5926,13 @@ var containerStyles = StyleSheet.create({
|
|
|
5908
5926
|
|
|
5909
5927
|
function formatNumberInput$1(value, formatDecimal) {
|
|
5910
5928
|
if (!value)
|
|
5911
|
-
return "
|
|
5929
|
+
return "";
|
|
5930
|
+
if (value === "")
|
|
5931
|
+
return "";
|
|
5912
5932
|
// Xử lý số âm
|
|
5913
5933
|
var isNegative = value.startsWith("-");
|
|
5914
5934
|
var _a = value.replace(/[^0-9.]/g, "").split("."), intPart = _a[0], decimalPart = _a[1];
|
|
5915
5935
|
// Format phần nguyên
|
|
5916
|
-
intPart = intPart.replace(/^0+(?=\d)/, ""); // Loại bỏ số 0 đầu nếu có
|
|
5917
5936
|
intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
5918
5937
|
// Giới hạn phần thập phân 3 số
|
|
5919
5938
|
if (decimalPart)
|
|
@@ -5926,7 +5945,7 @@ function formatNumberInput$1(value, formatDecimal) {
|
|
|
5926
5945
|
return result;
|
|
5927
5946
|
}
|
|
5928
5947
|
var TextInputNumber = function (_a) {
|
|
5929
|
-
var style = _a.style, _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.textError, textError = _d === void 0 ? "" : _d, left = _a.left, right = _a.right, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.suffix, suffix = _g === void 0 ? "" : _g, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, _j = _a.maxValue, maxValue = _j === void 0 ?
|
|
5948
|
+
var style = _a.style, _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.textError, textError = _d === void 0 ? "" : _d, left = _a.left, right = _a.right, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.suffix, suffix = _g === void 0 ? "" : _g, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, _j = _a.maxValue, maxValue = _j === void 0 ? 999999999999 : _j, _k = _a.minValue, minValue = _k === void 0 ? 0 : _k, _l = _a.type, type = _l === void 0 ? "integer" : _l, _m = _a.formatDecimal, formatDecimal = _m === void 0 ? 3 : _m, _o = _a.required, required = _o === void 0 ? false : _o, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required"]);
|
|
5930
5949
|
var theme = useInternalTheme();
|
|
5931
5950
|
var colors = theme.colors;
|
|
5932
5951
|
var _p = useState(false), isShowModalKeyboard = _p[0], setIsShowModalKeyboard = _p[1];
|
|
@@ -5964,11 +5983,21 @@ var TextInputNumber = function (_a) {
|
|
|
5964
5983
|
if (key === "del") {
|
|
5965
5984
|
setInputValue(function (prev) { return prev.slice(0, -1); });
|
|
5966
5985
|
}
|
|
5986
|
+
else if (key === "000") {
|
|
5987
|
+
if (type === "integer" && inputValue.length > 0) {
|
|
5988
|
+
setInputValue(function (prev) { return prev + "000"; });
|
|
5989
|
+
setIsFirstInput(false);
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5967
5992
|
else if (key === ".") {
|
|
5968
|
-
if (
|
|
5969
|
-
|
|
5970
|
-
inputValue
|
|
5971
|
-
|
|
5993
|
+
if (!inputValue.includes(".")) {
|
|
5994
|
+
// Nếu inputValue là "0" hoặc rỗng, giữ lại số 0 và thêm dấu "."
|
|
5995
|
+
if (inputValue === "0" || inputValue === "") {
|
|
5996
|
+
setInputValue("0.");
|
|
5997
|
+
}
|
|
5998
|
+
else {
|
|
5999
|
+
setInputValue(function (prev) { return prev + key; });
|
|
6000
|
+
}
|
|
5972
6001
|
setIsFirstInput(false);
|
|
5973
6002
|
}
|
|
5974
6003
|
}
|
|
@@ -5978,7 +6007,7 @@ var TextInputNumber = function (_a) {
|
|
|
5978
6007
|
setIsFirstInput(false);
|
|
5979
6008
|
}
|
|
5980
6009
|
else {
|
|
5981
|
-
var newInputValue = inputValue
|
|
6010
|
+
var newInputValue = inputValue + key;
|
|
5982
6011
|
var newValue = Number(newInputValue);
|
|
5983
6012
|
var maxValueNumber = Number(maxValue);
|
|
5984
6013
|
if (!isNaN(newValue) &&
|
|
@@ -5986,7 +6015,7 @@ var TextInputNumber = function (_a) {
|
|
|
5986
6015
|
newValue <= maxValueNumber) {
|
|
5987
6016
|
if (inputValue.includes(".")) {
|
|
5988
6017
|
var _a = inputValue.split("."), intPart = _a[0], _b = _a[1], decimalPart = _b === void 0 ? "" : _b;
|
|
5989
|
-
if (intPart.length <
|
|
6018
|
+
if (intPart.length < 12 && decimalPart.length === 0) {
|
|
5990
6019
|
setInputValue(function (prev) { return prev + key; });
|
|
5991
6020
|
}
|
|
5992
6021
|
else if (decimalPart.length < 3) {
|
|
@@ -5994,8 +6023,8 @@ var TextInputNumber = function (_a) {
|
|
|
5994
6023
|
}
|
|
5995
6024
|
}
|
|
5996
6025
|
else {
|
|
5997
|
-
if (inputValue.length <
|
|
5998
|
-
setInputValue(function (prev) { return
|
|
6026
|
+
if (inputValue.length < 12) {
|
|
6027
|
+
setInputValue(function (prev) { return prev + key; });
|
|
5999
6028
|
}
|
|
6000
6029
|
}
|
|
6001
6030
|
}
|
|
@@ -6003,7 +6032,7 @@ var TextInputNumber = function (_a) {
|
|
|
6003
6032
|
}
|
|
6004
6033
|
};
|
|
6005
6034
|
var handleClear = function () {
|
|
6006
|
-
setInputValue("
|
|
6035
|
+
setInputValue("");
|
|
6007
6036
|
};
|
|
6008
6037
|
var handleClearInput = function () {
|
|
6009
6038
|
setInputValue("");
|
|
@@ -6020,13 +6049,14 @@ var TextInputNumber = function (_a) {
|
|
|
6020
6049
|
setIsShowModalKeyboard(false);
|
|
6021
6050
|
};
|
|
6022
6051
|
var checkValueEmpty = function () {
|
|
6023
|
-
if (value.toString() === "") {
|
|
6052
|
+
if (value === undefined || value === null || value.toString() === "") {
|
|
6024
6053
|
return true;
|
|
6025
6054
|
}
|
|
6026
6055
|
return false;
|
|
6027
6056
|
};
|
|
6057
|
+
console.log(value, "value");
|
|
6028
6058
|
var checkLabelEmpty = function () {
|
|
6029
|
-
if (label.toString() === "") {
|
|
6059
|
+
if (label === undefined || label === null || label.toString() === "") {
|
|
6030
6060
|
return true;
|
|
6031
6061
|
}
|
|
6032
6062
|
return false;
|
|
@@ -6110,14 +6140,21 @@ var TextInputNumber = function (_a) {
|
|
|
6110
6140
|
["1", "2", "3"],
|
|
6111
6141
|
["4", "5", "6"],
|
|
6112
6142
|
["7", "8", "9"],
|
|
6113
|
-
[".", "0", "del"],
|
|
6143
|
+
[type === "integer" ? "000" : ".", "0", "del"],
|
|
6114
6144
|
].map(function (row, rowIndex) { return (React__default.createElement(View, { key: rowIndex, style: styles$b.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
|
|
6115
6145
|
styles$b.keyButton,
|
|
6116
|
-
key === "
|
|
6117
|
-
|
|
6146
|
+
key === "000" && type === "float" && styles$b.disabledKey,
|
|
6147
|
+
key === "." &&
|
|
6148
|
+
inputValue.includes(".") &&
|
|
6149
|
+
styles$b.disabledKey,
|
|
6150
|
+
], onPress: function () { return handleKeyPress(key); }, disabled: (key === "000" && type === "float") ||
|
|
6151
|
+
(key === "." && inputValue.includes(".")) }, key === "del" ? (React__default.createElement(Icon$1, { name: "IconDelNumber", type: "Svg", size: 24 })) : (React__default.createElement(Text$1, { style: [
|
|
6118
6152
|
styles$b.keyText,
|
|
6153
|
+
key === "000" &&
|
|
6154
|
+
type === "float" &&
|
|
6155
|
+
styles$b.disabledKeyText,
|
|
6119
6156
|
key === "." &&
|
|
6120
|
-
|
|
6157
|
+
inputValue.includes(".") &&
|
|
6121
6158
|
styles$b.disabledKeyText,
|
|
6122
6159
|
] }, key)))); }))); })),
|
|
6123
6160
|
React__default.createElement(View, { style: styles$b.actionRow },
|
|
@@ -6507,7 +6544,7 @@ var Button = function (_a) {
|
|
|
6507
6544
|
}
|
|
6508
6545
|
};
|
|
6509
6546
|
return (React__default.createElement(View, { row: !full },
|
|
6510
|
-
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled ||
|
|
6547
|
+
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading }),
|
|
6511
6548
|
React__default.createElement(View, { style: [
|
|
6512
6549
|
styles$a.button,
|
|
6513
6550
|
{
|
|
@@ -6520,7 +6557,8 @@ var Button = function (_a) {
|
|
|
6520
6557
|
backgroundColor && { backgroundColor: backgroundColor },
|
|
6521
6558
|
renderButtonStyle(),
|
|
6522
6559
|
buttonSize === "small" && styles$a.small,
|
|
6523
|
-
disabled &&
|
|
6560
|
+
disabled &&
|
|
6561
|
+
!isLoading && [
|
|
6524
6562
|
styles$a.disabled,
|
|
6525
6563
|
{
|
|
6526
6564
|
borderColor: colors.borderPrimaryDisabled,
|
|
@@ -7298,7 +7336,7 @@ var formatNumberInput = function (value, formatDecimal) {
|
|
|
7298
7336
|
return result;
|
|
7299
7337
|
};
|
|
7300
7338
|
var NumberKeyboard = function (_a) {
|
|
7301
|
-
var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, onChangeText = _a.onChangeText, _d = _a.maxValue, maxValue = _d === void 0 ?
|
|
7339
|
+
var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, onChangeText = _a.onChangeText, _d = _a.maxValue, maxValue = _d === void 0 ? 999999999999 : _d, _e = _a.type, type = _e === void 0 ? "integer" : _e, _f = _a.formatDecimal, formatDecimal = _f === void 0 ? 3 : _f, visible = _a.visible, onClose = _a.onClose;
|
|
7302
7340
|
var theme = useInternalTheme();
|
|
7303
7341
|
var colors = theme.colors;
|
|
7304
7342
|
var _g = useState((value === null || value === void 0 ? void 0 : value.toString()) || ""), inputValue = _g[0], setInputValue = _g[1];
|
|
@@ -7315,11 +7353,22 @@ var NumberKeyboard = function (_a) {
|
|
|
7315
7353
|
setIsFirstInput(false);
|
|
7316
7354
|
return;
|
|
7317
7355
|
}
|
|
7356
|
+
if (key === "000") {
|
|
7357
|
+
if (type === "integer" && inputValue.length > 0) {
|
|
7358
|
+
setInputValue(function (prev) { return prev + "000"; });
|
|
7359
|
+
setIsFirstInput(false);
|
|
7360
|
+
}
|
|
7361
|
+
return;
|
|
7362
|
+
}
|
|
7318
7363
|
if (key === ".") {
|
|
7319
|
-
if (type === "float" &&
|
|
7320
|
-
|
|
7321
|
-
inputValue
|
|
7322
|
-
|
|
7364
|
+
if (type === "float" && !inputValue.includes(".")) {
|
|
7365
|
+
// Nếu inputValue là "0" hoặc rỗng, giữ lại số 0 và thêm dấu "."
|
|
7366
|
+
if (inputValue === "0" || inputValue === "") {
|
|
7367
|
+
setInputValue("0.");
|
|
7368
|
+
}
|
|
7369
|
+
else {
|
|
7370
|
+
setInputValue(function (prev) { return prev + key; });
|
|
7371
|
+
}
|
|
7323
7372
|
setIsFirstInput(false);
|
|
7324
7373
|
}
|
|
7325
7374
|
return;
|
|
@@ -7329,7 +7378,7 @@ var NumberKeyboard = function (_a) {
|
|
|
7329
7378
|
setIsFirstInput(false);
|
|
7330
7379
|
return;
|
|
7331
7380
|
}
|
|
7332
|
-
var newInputValue = inputValue
|
|
7381
|
+
var newInputValue = inputValue + key;
|
|
7333
7382
|
var newValue = Number(newInputValue);
|
|
7334
7383
|
var maxValueNumber = Number(maxValue);
|
|
7335
7384
|
if (!isNaN(newValue) &&
|
|
@@ -7337,7 +7386,7 @@ var NumberKeyboard = function (_a) {
|
|
|
7337
7386
|
newValue <= maxValueNumber) {
|
|
7338
7387
|
if (inputValue.includes(".")) {
|
|
7339
7388
|
var _a = inputValue.split("."), intPart = _a[0], _b = _a[1], decimalPart = _b === void 0 ? "" : _b;
|
|
7340
|
-
if (intPart.length <
|
|
7389
|
+
if (intPart.length < 12 && decimalPart.length === 0) {
|
|
7341
7390
|
setInputValue(function (prev) { return prev + key; });
|
|
7342
7391
|
}
|
|
7343
7392
|
else if (decimalPart.length < formatDecimal) {
|
|
@@ -7345,8 +7394,8 @@ var NumberKeyboard = function (_a) {
|
|
|
7345
7394
|
}
|
|
7346
7395
|
}
|
|
7347
7396
|
else {
|
|
7348
|
-
if (inputValue.length <
|
|
7349
|
-
setInputValue(function (prev) { return
|
|
7397
|
+
if (inputValue.length < 12) {
|
|
7398
|
+
setInputValue(function (prev) { return prev + key; });
|
|
7350
7399
|
}
|
|
7351
7400
|
}
|
|
7352
7401
|
}
|
|
@@ -7367,13 +7416,6 @@ var NumberKeyboard = function (_a) {
|
|
|
7367
7416
|
onClose();
|
|
7368
7417
|
setIsFirstInput(true);
|
|
7369
7418
|
}, [onClose]);
|
|
7370
|
-
var renderKeyboardRow = useCallback(function (row) { return (React__default.createElement(View, { key: row.join(""), style: styles.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
|
|
7371
|
-
styles.keyButton,
|
|
7372
|
-
key === "." && type === "integer" && styles.disabledKey,
|
|
7373
|
-
], onPress: function () { return handleKeyPress(key); }, disabled: key === "." && type === "integer" }, key === "del" ? (React__default.createElement(Icon$1, { name: "IconDelNumber", type: "Svg", size: 24 })) : (React__default.createElement(Text$1, { style: [
|
|
7374
|
-
styles.keyText,
|
|
7375
|
-
key === "." && type === "integer" && styles.disabledKeyText,
|
|
7376
|
-
] }, key)))); }))); }, [handleKeyPress, type]);
|
|
7377
7419
|
return (React__default.createElement(Modal, { visible: visible, transparent: true, animationType: "fade", onRequestClose: handleClose },
|
|
7378
7420
|
React__default.createElement(TouchableOpacity, { style: styles.modalOverlay, activeOpacity: 1, onPress: handleClose },
|
|
7379
7421
|
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles.modalContent },
|
|
@@ -7387,8 +7429,23 @@ var NumberKeyboard = function (_a) {
|
|
|
7387
7429
|
["1", "2", "3"],
|
|
7388
7430
|
["4", "5", "6"],
|
|
7389
7431
|
["7", "8", "9"],
|
|
7390
|
-
[".", "0", "del"],
|
|
7391
|
-
].map(
|
|
7432
|
+
[type === "integer" ? "000" : ".", "0", "del"],
|
|
7433
|
+
].map(function (row, rowIndex) { return (React__default.createElement(View, { key: rowIndex, style: styles.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
|
|
7434
|
+
styles.keyButton,
|
|
7435
|
+
key === "000" && type === "float" && styles.disabledKey,
|
|
7436
|
+
key === "." &&
|
|
7437
|
+
inputValue.includes(".") &&
|
|
7438
|
+
styles.disabledKey,
|
|
7439
|
+
], onPress: function () { return handleKeyPress(key); }, disabled: (key === "000" && type === "float") ||
|
|
7440
|
+
(key === "." && inputValue.includes(".")) }, key === "del" ? (React__default.createElement(Icon$1, { name: "IconDelNumber", type: "Svg", size: 24 })) : (React__default.createElement(Text$1, { style: [
|
|
7441
|
+
styles.keyText,
|
|
7442
|
+
key === "000" &&
|
|
7443
|
+
type === "float" &&
|
|
7444
|
+
styles.disabledKeyText,
|
|
7445
|
+
key === "." &&
|
|
7446
|
+
inputValue.includes(".") &&
|
|
7447
|
+
styles.disabledKeyText,
|
|
7448
|
+
] }, key)))); }))); })),
|
|
7392
7449
|
React__default.createElement(View, { style: styles.actionRow },
|
|
7393
7450
|
React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles.actionButton, onPress: handleClose },
|
|
7394
7451
|
React__default.createElement(Text$1, { style: styles.actionText }, "\u0110\u00F3ng")),
|