tnx-shared 5.3.414 → 5.3.416
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/bundles/tnx-shared.umd.js +72 -1
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/esm2015/classes/base/list-component-base.js +2 -2
- package/esm2015/services/common.service.js +71 -1
- package/esm2015/tnx-shared.module.js +2 -1
- package/fesm2015/tnx-shared.js +72 -1
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/common.service.d.ts +1 -0
- package/services/common.service.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
- package/tnx-shared.module.d.ts.map +1 -1
|
@@ -5109,6 +5109,76 @@
|
|
|
5109
5109
|
doc = null; // Dọn dẹp tham chiếu (không cần thiết nếu scope kết thúc)
|
|
5110
5110
|
return result;
|
|
5111
5111
|
};
|
|
5112
|
+
CommonService.prototype.tryParseFlexibleNumber = function (input) {
|
|
5113
|
+
if (input == null || typeof input !== 'string')
|
|
5114
|
+
return input;
|
|
5115
|
+
var str = input.trim();
|
|
5116
|
+
if (str === '')
|
|
5117
|
+
return input;
|
|
5118
|
+
// Xử lý dấu +/- ở đầu
|
|
5119
|
+
var sign = '';
|
|
5120
|
+
var startIndex = 0;
|
|
5121
|
+
if (str[0] === '-' || str[0] === '+') {
|
|
5122
|
+
sign = str[0];
|
|
5123
|
+
startIndex = 1;
|
|
5124
|
+
}
|
|
5125
|
+
var numericPart = str.slice(startIndex);
|
|
5126
|
+
if (numericPart === '')
|
|
5127
|
+
return null;
|
|
5128
|
+
if ((numericPart === null || numericPart === void 0 ? void 0 : numericPart.length) > 1 && numericPart[0] === '0') {
|
|
5129
|
+
// Kiểm tra có phải dạng "0.xxx" hoặc "0,xxx"?
|
|
5130
|
+
var secondChar = numericPart[1];
|
|
5131
|
+
if (secondChar !== '.' && secondChar !== ',') {
|
|
5132
|
+
// Ví dụ: "0123", "00", "01.23" → từ chối
|
|
5133
|
+
return input;
|
|
5134
|
+
}
|
|
5135
|
+
}
|
|
5136
|
+
// Kiểm tra từng ký tự — dừng ngay nếu gặp ký tự không hợp lệ
|
|
5137
|
+
var commaCount = 0, dotCount = 0, lastComma = -1, lastDot = -1;
|
|
5138
|
+
for (var i = 0; i < numericPart.length; i++) {
|
|
5139
|
+
var char = numericPart[i];
|
|
5140
|
+
if (char >= '0' && char <= '9')
|
|
5141
|
+
continue;
|
|
5142
|
+
else if (char === ',') {
|
|
5143
|
+
commaCount++;
|
|
5144
|
+
lastComma = i;
|
|
5145
|
+
}
|
|
5146
|
+
else if (char === '.') {
|
|
5147
|
+
dotCount++;
|
|
5148
|
+
lastDot = i;
|
|
5149
|
+
}
|
|
5150
|
+
else
|
|
5151
|
+
return input; // ký tự không hợp lệ
|
|
5152
|
+
}
|
|
5153
|
+
// Sau khi xác minh tất cả ký tự hợp lệ, mới xử lý định dạng
|
|
5154
|
+
var normalized = str.slice(startIndex); // loại bỏ dấu
|
|
5155
|
+
if (commaCount === 0 && dotCount === 0) {
|
|
5156
|
+
// OK: số nguyên
|
|
5157
|
+
}
|
|
5158
|
+
else if (dotCount === 1 && (commaCount === 0 || lastDot > lastComma)) {
|
|
5159
|
+
// Chuẩn Mỹ: xóa dấu phẩy
|
|
5160
|
+
normalized = normalized.replace(/,/g, '');
|
|
5161
|
+
}
|
|
5162
|
+
else if (commaCount === 1 && (dotCount === 0 || lastComma > lastDot)) {
|
|
5163
|
+
// Chuẩn VN: xóa dấu chấm, đổi phẩy → chấm
|
|
5164
|
+
var temp = '';
|
|
5165
|
+
for (var i = 0; i < normalized.length; i++) {
|
|
5166
|
+
if (normalized[i] === '.')
|
|
5167
|
+
continue;
|
|
5168
|
+
if (normalized[i] === ',')
|
|
5169
|
+
temp += '.';
|
|
5170
|
+
else
|
|
5171
|
+
temp += normalized[i];
|
|
5172
|
+
}
|
|
5173
|
+
normalized = temp;
|
|
5174
|
+
}
|
|
5175
|
+
else {
|
|
5176
|
+
// Quá nhiều dấu → không xác định
|
|
5177
|
+
return input;
|
|
5178
|
+
}
|
|
5179
|
+
var num = parseFloat(sign + normalized);
|
|
5180
|
+
return isNaN(num) ? input : num;
|
|
5181
|
+
};
|
|
5112
5182
|
return CommonService;
|
|
5113
5183
|
}());
|
|
5114
5184
|
CommonService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CommonService_Factory() { return new CommonService(i0__namespace.ɵɵinject(ModuleConfigService)); }, token: CommonService, providedIn: "root" });
|
|
@@ -23965,7 +24035,7 @@
|
|
|
23965
24035
|
this.getValueRow(rowData, index + 1, value);
|
|
23966
24036
|
}
|
|
23967
24037
|
else {
|
|
23968
|
-
rowData[index] = value;
|
|
24038
|
+
rowData[index] = this._commonService.tryParseFlexibleNumber(value);
|
|
23969
24039
|
}
|
|
23970
24040
|
};
|
|
23971
24041
|
ListComponentBase.prototype.headHtmlToString = function (arrHeadEle) {
|
|
@@ -58116,6 +58186,7 @@
|
|
|
58116
58186
|
];
|
|
58117
58187
|
|
|
58118
58188
|
// 1
|
|
58189
|
+
// 2
|
|
58119
58190
|
function coreDeclaration() {
|
|
58120
58191
|
return [
|
|
58121
58192
|
AddressComponent,
|