@linzjs/step-ag-grid 7.6.2 → 7.7.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 CHANGED
@@ -1327,7 +1327,7 @@ var wait$2 = function (timeoutMs) {
1327
1327
  });
1328
1328
  };
1329
1329
  var isFloat = function (value) {
1330
- var regexp = /^-?\d+(\.\d+)?$/;
1330
+ var regexp = /^-?\d*(\.\d+)?$/;
1331
1331
  return regexp.test(value);
1332
1332
  };
1333
1333
  var findParentWithClass = function (className, child) {
@@ -4197,17 +4197,40 @@ 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
- console.error("Value is not a string", value);
4201
- return null;
4200
+ return "Value is not a string";
4202
4201
  }
4203
- if (props.required && value.length === 0) {
4204
- return "Some text is required";
4202
+ if (props.required && value == "") {
4203
+ return "Must not be empty";
4205
4204
  }
4206
4205
  if (props.maxLength && value.length > props.maxLength) {
4207
- return "Text must be no longer than ".concat(props.maxLength, " characters");
4206
+ return "Must be no longer than ".concat(props.maxLength, " characters");
4208
4207
  }
4209
4208
  if (props.maxBytes && stringByteLengthIsInvalid(value, props.maxBytes)) {
4210
- return "Text must be no longer than ".concat(props.maxLength, " bytes");
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
+ var number = parseFloat(value);
4217
+ if (nf.gtMin != null && number <= nf.gtMin) {
4218
+ return "Must be greater than ".concat(nf.gtMin);
4219
+ }
4220
+ if (nf.geMin != null && number < nf.geMin) {
4221
+ return "Must not be less than ".concat(nf.geMin);
4222
+ }
4223
+ if (nf.ltMax != null && number >= nf.ltMax) {
4224
+ return "Must be less than ".concat(nf.ltMax);
4225
+ }
4226
+ if (nf.leMax != null && number > nf.leMax) {
4227
+ return "Must not be greater than ".concat(nf.leMax);
4228
+ }
4229
+ if (nf.precision != null && value != "") {
4230
+ if (parseFloat(number.toPrecision(nf.precision + 1)) != number) {
4231
+ return nf.precision == 0 ? "Must be a whole number" : "Must have no more than ".concat(nf.precision, " decimal places");
4232
+ }
4233
+ }
4211
4234
  }
4212
4235
  if (props.invalid) {
4213
4236
  return props.invalid(value, data, context);