@linzjs/step-ag-grid 7.6.1 → 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/GridTheme.scss +4 -4
- package/dist/index.js +43 -14
- package/dist/index.js.map +1 -1
- package/dist/src/utils/textValidator.d.ts +7 -0
- package/dist/src/utils/textValidator.test.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +43 -14
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +7 -3
- package/src/components/GridCell.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +4 -1
- package/src/contexts/GridPopoverContextProvider.tsx +1 -3
- package/src/styles/GridTheme.scss +4 -4
- package/src/utils/deferredPromise.ts +8 -1
- package/src/utils/textValidator.test.ts +95 -0
- package/src/utils/textValidator.ts +37 -7
- package/src/utils/util.ts +1 -1
package/dist/GridTheme.scss
CHANGED
|
@@ -75,8 +75,6 @@
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.ag-cell.ag-cell-inline-editing {
|
|
78
|
-
padding-left: 9px;
|
|
79
|
-
padding-right: 9px;
|
|
80
78
|
bottom: 0;
|
|
81
79
|
}
|
|
82
80
|
|
|
@@ -84,9 +82,11 @@
|
|
|
84
82
|
word-break: break-word;
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
.ag-cell-popup-editing,
|
|
88
|
-
.ag-selected-for-edit,
|
|
85
|
+
.ag-cell.ag-cell-popup-editing,
|
|
86
|
+
.ag-cell.ag-selected-for-edit,
|
|
89
87
|
.ag-cell-inline-editing {
|
|
88
|
+
padding-left: 9px;
|
|
89
|
+
padding-right: 9px;
|
|
90
90
|
background: rgb(72 160 244 / 20%);
|
|
91
91
|
// These are important, it needs to override ag-grid to work
|
|
92
92
|
border: 3px solid #48a0f4 !important;
|
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) {
|
|
@@ -2287,7 +2287,10 @@ var GridContextProvider = function (props) {
|
|
|
2287
2287
|
case 0:
|
|
2288
2288
|
// Need to refresh to get spinners to work on all rows
|
|
2289
2289
|
gridApi.refreshCells({ rowNodes: props.selectedRows, force: true });
|
|
2290
|
-
return [4 /*yield*/, fnUpdate(selectedRows)]
|
|
2290
|
+
return [4 /*yield*/, fnUpdate(selectedRows)["catch"](function (ex) {
|
|
2291
|
+
console.error("Exception during modifyUpdating", ex);
|
|
2292
|
+
return false;
|
|
2293
|
+
})];
|
|
2291
2294
|
case 1:
|
|
2292
2295
|
ok = _a.sent();
|
|
2293
2296
|
return [2 /*return*/];
|
|
@@ -2435,7 +2438,7 @@ var GridPopoverContextProvider = function (_a) {
|
|
|
2435
2438
|
var selectedRows = React.useMemo(function () { return (multiEdit ? lodashEs.sortBy(getSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data]); }, [getSelectedRows, multiEdit, props.data]);
|
|
2436
2439
|
var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
|
|
2437
2440
|
var updateValue = React.useCallback(function (saveFn, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2438
|
-
var
|
|
2441
|
+
var _a;
|
|
2439
2442
|
return __generator(this, function (_b) {
|
|
2440
2443
|
switch (_b.label) {
|
|
2441
2444
|
case 0:
|
|
@@ -2449,10 +2452,7 @@ var GridPopoverContextProvider = function (_a) {
|
|
|
2449
2452
|
case 2:
|
|
2450
2453
|
_a = _b.sent();
|
|
2451
2454
|
_b.label = 3;
|
|
2452
|
-
case 3:
|
|
2453
|
-
r = _a;
|
|
2454
|
-
//if (r) stopEditing();
|
|
2455
|
-
return [2 /*return*/, r];
|
|
2455
|
+
case 3: return [2 /*return*/, _a];
|
|
2456
2456
|
}
|
|
2457
2457
|
});
|
|
2458
2458
|
}); }, [field, saving, selectedRows, updatingCells]);
|
|
@@ -2889,7 +2889,7 @@ var GridCellRenderer = function (props) {
|
|
|
2889
2889
|
var GridCell = function (props, custom) {
|
|
2890
2890
|
var _a;
|
|
2891
2891
|
return __assign(__assign(__assign(__assign(__assign(__assign({ colId: props.field, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, ((custom === null || custom === void 0 ? void 0 : custom.editor) && {
|
|
2892
|
-
cellClassRules: GridCellMultiSelectClassRules,
|
|
2892
|
+
cellClassRules: custom.multiEdit ? GridCellMultiSelectClassRules : undefined,
|
|
2893
2893
|
editable: (_a = props.editable) !== null && _a !== void 0 ? _a : true,
|
|
2894
2894
|
cellEditor: GenericCellEditorComponentWrapper(custom)
|
|
2895
2895
|
})), { suppressKeyboardEvent: function (e) {
|
|
@@ -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
|
-
|
|
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
|
+
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);
|
|
@@ -4443,6 +4466,12 @@ var ActionButton = function (_a) {
|
|
|
4443
4466
|
var useDeferredPromise = function () {
|
|
4444
4467
|
var promiseResolve = React.useRef();
|
|
4445
4468
|
var promiseReject = React.useRef();
|
|
4469
|
+
// End promise on unload
|
|
4470
|
+
React.useEffect(function () {
|
|
4471
|
+
return function () {
|
|
4472
|
+
promiseReject.current && promiseReject.current();
|
|
4473
|
+
};
|
|
4474
|
+
}, []);
|
|
4446
4475
|
return {
|
|
4447
4476
|
invoke: function () {
|
|
4448
4477
|
return new Promise(function (resolve, reject) {
|