@linzjs/step-ag-grid 7.6.2 → 7.8.0
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.js +37 -7
- package/dist/index.js.map +1 -1
- package/dist/src/utils/textValidator.d.ts +8 -0
- package/dist/src/utils/textValidator.test.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +37 -7
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +7 -3
- package/src/utils/textValidator.test.ts +107 -0
- package/src/utils/textValidator.ts +47 -7
- package/src/utils/util.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1327,7 +1327,7 @@ var wait$2 = function (timeoutMs) {
|
|
|
1327
1327
|
});
|
|
1328
1328
|
};
|
|
1329
1329
|
var isFloat = function (value) {
|
|
1330
|
-
var regexp = /^-?\d
|
|
1330
|
+
var regexp = /^-?\d*(\.\d+)?$/;
|
|
1331
1331
|
return regexp.test(value);
|
|
1332
1332
|
};
|
|
1333
1333
|
var findParentWithClass = function (className, child) {
|
|
@@ -4197,17 +4197,47 @@ var TextInputValidator = function (props, value, data, context) {
|
|
|
4197
4197
|
return null;
|
|
4198
4198
|
// This can happen because subcomponent is invoked without type safety
|
|
4199
4199
|
if (typeof value !== "string") {
|
|
4200
|
-
|
|
4201
|
-
return null;
|
|
4200
|
+
return "Value is not a string";
|
|
4202
4201
|
}
|
|
4203
|
-
if (props.required && value
|
|
4204
|
-
return "
|
|
4202
|
+
if (props.required && value == "") {
|
|
4203
|
+
return "Must not be empty";
|
|
4205
4204
|
}
|
|
4206
4205
|
if (props.maxLength && value.length > props.maxLength) {
|
|
4207
|
-
return "
|
|
4206
|
+
return "Must be no longer than ".concat(props.maxLength, " characters");
|
|
4208
4207
|
}
|
|
4209
4208
|
if (props.maxBytes && stringByteLengthIsInvalid(value, props.maxBytes)) {
|
|
4210
|
-
return "
|
|
4209
|
+
return "Must be no longer than ".concat(props.maxBytes, " bytes");
|
|
4210
|
+
}
|
|
4211
|
+
var nf = props.numberFormat;
|
|
4212
|
+
if (nf) {
|
|
4213
|
+
if (value != "" && !isFloat(value)) {
|
|
4214
|
+
return "Must be a valid number";
|
|
4215
|
+
}
|
|
4216
|
+
if (value != "") {
|
|
4217
|
+
var number = parseFloat(value);
|
|
4218
|
+
if (nf.gtMin != null && number <= nf.gtMin) {
|
|
4219
|
+
return "Must be greater than ".concat(nf.gtMin);
|
|
4220
|
+
}
|
|
4221
|
+
if (nf.geMin != null && number < nf.geMin) {
|
|
4222
|
+
return "Must not be less than ".concat(nf.geMin);
|
|
4223
|
+
}
|
|
4224
|
+
if (nf.ltMax != null && number >= nf.ltMax) {
|
|
4225
|
+
return "Must be less than ".concat(nf.ltMax);
|
|
4226
|
+
}
|
|
4227
|
+
if (nf.leMax != null && number > nf.leMax) {
|
|
4228
|
+
return "Must not be greater than ".concat(nf.leMax);
|
|
4229
|
+
}
|
|
4230
|
+
if (nf.precision != null && value != "") {
|
|
4231
|
+
if (parseFloat(number.toPrecision(nf.precision)) != number) {
|
|
4232
|
+
return "Must have no more than ".concat(nf.precision, " digits precision");
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
if (nf.scale != null && value != "") {
|
|
4236
|
+
if (parseFloat(number.toFixed(nf.scale)) != number) {
|
|
4237
|
+
return nf.scale == 0 ? "Must be a whole number" : "Must have no more than ".concat(nf.scale, " decimal places");
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4211
4241
|
}
|
|
4212
4242
|
if (props.invalid) {
|
|
4213
4243
|
return props.invalid(value, data, context);
|