@linzjs/step-ag-grid 7.7.0 → 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 +23 -16
- package/dist/index.js.map +1 -1
- package/dist/src/utils/textValidator.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +23 -16
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/textValidator.test.ts +14 -2
- package/src/utils/textValidator.ts +26 -16
|
@@ -7,6 +7,7 @@ export interface TextInputValidatorProps<RowType extends GridBaseRow> {
|
|
|
7
7
|
invalid?: (value: string, data: RowType, context: any) => JSX.Element | string | null;
|
|
8
8
|
numberFormat?: {
|
|
9
9
|
precision?: number;
|
|
10
|
+
scale?: number;
|
|
10
11
|
gtMin?: number;
|
|
11
12
|
geMin?: number;
|
|
12
13
|
ltMax?: number;
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -4192,22 +4192,29 @@ var TextInputValidator = function (props, value, data, context) {
|
|
|
4192
4192
|
if (value != "" && !isFloat(value)) {
|
|
4193
4193
|
return "Must be a valid number";
|
|
4194
4194
|
}
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
if (
|
|
4210
|
-
|
|
4195
|
+
if (value != "") {
|
|
4196
|
+
var number = parseFloat(value);
|
|
4197
|
+
if (nf.gtMin != null && number <= nf.gtMin) {
|
|
4198
|
+
return "Must be greater than ".concat(nf.gtMin);
|
|
4199
|
+
}
|
|
4200
|
+
if (nf.geMin != null && number < nf.geMin) {
|
|
4201
|
+
return "Must not be less than ".concat(nf.geMin);
|
|
4202
|
+
}
|
|
4203
|
+
if (nf.ltMax != null && number >= nf.ltMax) {
|
|
4204
|
+
return "Must be less than ".concat(nf.ltMax);
|
|
4205
|
+
}
|
|
4206
|
+
if (nf.leMax != null && number > nf.leMax) {
|
|
4207
|
+
return "Must not be greater than ".concat(nf.leMax);
|
|
4208
|
+
}
|
|
4209
|
+
if (nf.precision != null && value != "") {
|
|
4210
|
+
if (parseFloat(number.toPrecision(nf.precision)) != number) {
|
|
4211
|
+
return "Must have no more than ".concat(nf.precision, " digits precision");
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
if (nf.scale != null && value != "") {
|
|
4215
|
+
if (parseFloat(number.toFixed(nf.scale)) != number) {
|
|
4216
|
+
return nf.scale == 0 ? "Must be a whole number" : "Must have no more than ".concat(nf.scale, " decimal places");
|
|
4217
|
+
}
|
|
4211
4218
|
}
|
|
4212
4219
|
}
|
|
4213
4220
|
}
|