@linzjs/step-ag-grid 5.0.1 → 6.0.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 +100 -84
- package/dist/index.js.map +1 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +11 -11
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +1 -1
- package/dist/src/contexts/GridContext.d.ts +1 -2
- package/dist/src/utils/bearing.d.ts +1 -1
- package/dist/src/utils/textValidator.d.ts +2 -1
- package/dist/step-ag-grid.esm.js +100 -84
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridPopoverHook.tsx +2 -2
- package/src/components/gridForm/GridFormDropDown.tsx +49 -46
- package/src/components/gridForm/GridFormPopoverMenu.tsx +10 -24
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +3 -3
- package/src/contexts/GridContext.tsx +1 -4
- package/src/contexts/GridContextProvider.tsx +16 -2
- package/src/contexts/GridPopoverContextProvider.tsx +8 -12
- package/src/react-menu3/components/ControlledMenu.tsx +6 -4
- package/src/stories/grid/GridPopoutEditDropDown.stories.tsx +4 -39
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +3 -4
- package/src/stories/grid/GridReadOnly.stories.tsx +0 -1
- package/src/utils/bearing.ts +2 -2
- package/src/utils/textValidator.ts +7 -3
package/dist/index.js
CHANGED
|
@@ -1347,8 +1347,10 @@ var ControlledMenuFr = function (_a, externalRef) {
|
|
|
1347
1347
|
// the cell doesn't refresh during update if save is invoked from a native event
|
|
1348
1348
|
// This doesn't happen in React18
|
|
1349
1349
|
// To work around it, I invoke the save by clicking on a passed in invisible button ref
|
|
1350
|
-
if (saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current)
|
|
1350
|
+
if (saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current) {
|
|
1351
|
+
saveButtonRef.current.setAttribute("data-reason", CloseReason.BLUR);
|
|
1351
1352
|
saveButtonRef.current.click();
|
|
1353
|
+
}
|
|
1352
1354
|
else
|
|
1353
1355
|
safeCall(onClose, { reason: CloseReason.BLUR });
|
|
1354
1356
|
// If a user clicks on the menu button when a menu is open, we need to close the menu.
|
|
@@ -1481,8 +1483,8 @@ var ControlledMenuFr = function (_a, externalRef) {
|
|
|
1481
1483
|
thisDocument_1.addEventListener("click", handleScreenEventForCancel, true);
|
|
1482
1484
|
thisDocument_1.addEventListener("dblclick", handleScreenEventForCancel, true);
|
|
1483
1485
|
return function () {
|
|
1484
|
-
thisDocument_1.
|
|
1485
|
-
thisDocument_1.
|
|
1486
|
+
thisDocument_1.removeEventListener("keydown", handleKeydownTabAndEnter, true);
|
|
1487
|
+
thisDocument_1.removeEventListener("keyup", handleKeyupTabAndEnter, true);
|
|
1486
1488
|
thisDocument_1.removeEventListener("mousedown", handleScreenEventForSave, true);
|
|
1487
1489
|
thisDocument_1.removeEventListener("mouseup", handleScreenEventForCancel, true);
|
|
1488
1490
|
thisDocument_1.removeEventListener("click", handleScreenEventForCancel, true);
|
|
@@ -1991,9 +1993,6 @@ var GridContext = react.createContext({
|
|
|
1991
1993
|
}); },
|
|
1992
1994
|
redrawRows: function () {
|
|
1993
1995
|
console.error("no context provider for redrawRows");
|
|
1994
|
-
},
|
|
1995
|
-
selectNextCell: function () {
|
|
1996
|
-
console.error("no context provider for selectNextCell");
|
|
1997
1996
|
}
|
|
1998
1997
|
});
|
|
1999
1998
|
|
|
@@ -2213,17 +2212,18 @@ var GridContextProvider = function (props) {
|
|
|
2213
2212
|
});
|
|
2214
2213
|
};
|
|
2215
2214
|
var stopEditing = function () { return gridApiOp(function (gridApi) { return gridApi.stopEditing(); }); };
|
|
2216
|
-
var updatingCells = function (props, fnUpdate, setSaving) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2215
|
+
var updatingCells = function (props, fnUpdate, setSaving, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2217
2216
|
return __generator(this, function (_a) {
|
|
2218
2217
|
switch (_a.label) {
|
|
2219
2218
|
case 0:
|
|
2220
2219
|
setSaving && setSaving(true);
|
|
2221
2220
|
return [4 /*yield*/, gridApiOp(function (gridApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2222
|
-
var selectedRows, ok, cell;
|
|
2221
|
+
var preOpCell, selectedRows, ok, cell, postOpCell;
|
|
2223
2222
|
var _a;
|
|
2224
2223
|
return __generator(this, function (_b) {
|
|
2225
2224
|
switch (_b.label) {
|
|
2226
2225
|
case 0:
|
|
2226
|
+
preOpCell = gridApi.getFocusedCell();
|
|
2227
2227
|
selectedRows = props.selectedRows;
|
|
2228
2228
|
ok = false;
|
|
2229
2229
|
return [4 /*yield*/, modifyUpdating((_a = props.field) !== null && _a !== void 0 ? _a : "", selectedRows.map(function (data) { return data.id; }), function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2255,6 +2255,14 @@ var GridContextProvider = function (props) {
|
|
|
2255
2255
|
// Don't set saving if ok as the form has already closed
|
|
2256
2256
|
setSaving && setSaving(false);
|
|
2257
2257
|
}
|
|
2258
|
+
postOpCell = gridApi.getFocusedCell();
|
|
2259
|
+
if (tabDirection &&
|
|
2260
|
+
preOpCell &&
|
|
2261
|
+
postOpCell &&
|
|
2262
|
+
preOpCell.rowIndex == postOpCell.rowIndex &&
|
|
2263
|
+
preOpCell.column.getColId() == postOpCell.column.getColId()) {
|
|
2264
|
+
selectNextCell(tabDirection);
|
|
2265
|
+
}
|
|
2258
2266
|
return [2 /*return*/, ok];
|
|
2259
2267
|
}
|
|
2260
2268
|
});
|
|
@@ -2295,8 +2303,7 @@ var GridContextProvider = function (props) {
|
|
|
2295
2303
|
sizeColumnsToFit: sizeColumnsToFit,
|
|
2296
2304
|
stopEditing: stopEditing,
|
|
2297
2305
|
updatingCells: updatingCells,
|
|
2298
|
-
redrawRows: redrawRows
|
|
2299
|
-
selectNextCell: selectNextCell
|
|
2306
|
+
redrawRows: redrawRows
|
|
2300
2307
|
} }, { children: props.children })));
|
|
2301
2308
|
};
|
|
2302
2309
|
|
|
@@ -2361,8 +2368,9 @@ var useGridPopoverContext = function () {
|
|
|
2361
2368
|
var GridPopoverContextProvider = function (_a) {
|
|
2362
2369
|
var _b, _c, _d;
|
|
2363
2370
|
var props = _a.props, children = _a.children;
|
|
2364
|
-
var _e = react.useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells
|
|
2371
|
+
var _e = react.useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells;
|
|
2365
2372
|
var anchorRef = react.useRef(props.eGridCell);
|
|
2373
|
+
var hasSaved = react.useRef(false);
|
|
2366
2374
|
var _f = react.useState(false), saving = _f[0], setSaving = _f[1];
|
|
2367
2375
|
var colDef = props.colDef;
|
|
2368
2376
|
var cellEditorParams = colDef.cellEditorParams;
|
|
@@ -2371,24 +2379,27 @@ var GridPopoverContextProvider = function (_a) {
|
|
|
2371
2379
|
var selectedRows = react.useMemo(function () { return (multiEdit ? lodashEs.sortBy(getSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data]); }, [getSelectedRows, multiEdit, props.data]);
|
|
2372
2380
|
var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
|
|
2373
2381
|
var updateValue = react.useCallback(function (saveFn, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2374
|
-
var
|
|
2375
|
-
return __generator(this, function (
|
|
2376
|
-
switch (
|
|
2382
|
+
var r, _a;
|
|
2383
|
+
return __generator(this, function (_b) {
|
|
2384
|
+
switch (_b.label) {
|
|
2377
2385
|
case 0:
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
case
|
|
2386
|
+
if (hasSaved.current)
|
|
2387
|
+
return [2 /*return*/, true];
|
|
2388
|
+
hasSaved.current = true;
|
|
2389
|
+
if (!saving) return [3 /*break*/, 1];
|
|
2390
|
+
_a = false;
|
|
2391
|
+
return [3 /*break*/, 3];
|
|
2392
|
+
case 1: return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving, tabDirection)];
|
|
2393
|
+
case 2:
|
|
2394
|
+
_a = _b.sent();
|
|
2395
|
+
_b.label = 3;
|
|
2396
|
+
case 3:
|
|
2397
|
+
r = _a;
|
|
2398
|
+
//if (r) stopEditing();
|
|
2399
|
+
return [2 /*return*/, r];
|
|
2389
2400
|
}
|
|
2390
2401
|
});
|
|
2391
|
-
}); }, [field, saving,
|
|
2402
|
+
}); }, [field, saving, selectedRows, updatingCells]);
|
|
2392
2403
|
return (jsxRuntime.jsx(GridPopoverContext.Provider, __assign({ value: {
|
|
2393
2404
|
anchorRef: anchorRef,
|
|
2394
2405
|
saving: saving,
|
|
@@ -2920,7 +2931,7 @@ var useGridPopoverHook = function (props) {
|
|
|
2920
2931
|
return __generator(this, function (_a) {
|
|
2921
2932
|
switch (_a.label) {
|
|
2922
2933
|
case 0:
|
|
2923
|
-
if (reason ==
|
|
2934
|
+
if (reason == CloseReason.CANCEL) {
|
|
2924
2935
|
stopEditing();
|
|
2925
2936
|
return [2 /*return*/];
|
|
2926
2937
|
}
|
|
@@ -2949,7 +2960,7 @@ var useGridPopoverHook = function (props) {
|
|
|
2949
2960
|
var popoverWrapper = react.useCallback(function (children) {
|
|
2950
2961
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: anchorRef.current && (jsxRuntime.jsxs(ControlledMenu, __assign({ state: isOpen ? "open" : "closed", portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: "step-ag-grid-react-menu", onClose: function (event) {
|
|
2951
2962
|
// Prevent menu from closing when modals are invoked
|
|
2952
|
-
if (event.reason ===
|
|
2963
|
+
if (event.reason === CloseReason.BLUR)
|
|
2953
2964
|
return;
|
|
2954
2965
|
triggerSave(event.reason).then();
|
|
2955
2966
|
}, viewScroll: "auto", dontShrinkIfDirectionIsTop: true, className: props.className, closeMenuExclusionClassName: "ReactModal__Content" }, { children: [saving && ( // This is the overlay that prevents editing when the editor is saving
|
|
@@ -3080,7 +3091,6 @@ var fieldToString = function (field) {
|
|
|
3080
3091
|
var GridFormDropDown = function (props) {
|
|
3081
3092
|
var _a = useGridPopoverContext(), selectedRows = _a.selectedRows, field = _a.field, updateValue = _a.updateValue, data = _a.data;
|
|
3082
3093
|
// Save triggers during async action processing which triggers another selectItem(), this ref blocks that
|
|
3083
|
-
var hasSubmitted = react.useRef(false);
|
|
3084
3094
|
var _b = react.useState(""), filter = _b[0], setFilter = _b[1];
|
|
3085
3095
|
var _c = react.useState([]), filteredValues = _c[0], setFilteredValues = _c[1];
|
|
3086
3096
|
var optionsInitialising = react.useRef(false);
|
|
@@ -3088,32 +3098,39 @@ var GridFormDropDown = function (props) {
|
|
|
3088
3098
|
var subComponentIsValid = react.useRef(false);
|
|
3089
3099
|
var _e = react.useState(), subSelectedValue = _e[0], setSubSelectedValue = _e[1];
|
|
3090
3100
|
var _f = react.useState(null), selectedSubComponent = _f[0], setSelectedSubComponent = _f[1];
|
|
3091
|
-
var selectItemHandler = react.useCallback(function (value, subComponentValue
|
|
3101
|
+
var selectItemHandler = react.useCallback(function (value, subComponentValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3102
|
+
var hasChanged;
|
|
3092
3103
|
return __generator(this, function (_a) {
|
|
3093
|
-
|
|
3104
|
+
switch (_a.label) {
|
|
3105
|
+
case 0:
|
|
3106
|
+
hasChanged = selectedRows.some(function (row) { return row[field] !== value; });
|
|
3107
|
+
if (!hasChanged) return [3 /*break*/, 3];
|
|
3108
|
+
if (!props.onSelectedItem) return [3 /*break*/, 2];
|
|
3109
|
+
return [4 /*yield*/, props.onSelectedItem({ selectedRows: selectedRows, value: value, subComponentValue: subComponentValue })];
|
|
3110
|
+
case 1:
|
|
3111
|
+
_a.sent();
|
|
3112
|
+
return [3 /*break*/, 3];
|
|
3113
|
+
case 2:
|
|
3114
|
+
selectedRows.forEach(function (row) { return (row[field] = value); });
|
|
3115
|
+
_a.label = 3;
|
|
3116
|
+
case 3: return [2 /*return*/, true];
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
}); }, [field, props, selectedRows]);
|
|
3120
|
+
var clickItemHandler = react.useCallback(function (value, subComponentValue, reason) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3121
|
+
return __generator(this, function (_a) {
|
|
3122
|
+
if (subComponentValue !== undefined && !subComponentIsValid.current)
|
|
3094
3123
|
return [2 /*return*/, false];
|
|
3095
|
-
|
|
3096
|
-
return [2 /*return*/, updateValue(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3097
|
-
var hasChanged;
|
|
3124
|
+
return [2 /*return*/, updateValue(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3098
3125
|
return __generator(this, function (_a) {
|
|
3099
3126
|
switch (_a.label) {
|
|
3100
|
-
case 0:
|
|
3101
|
-
|
|
3102
|
-
if (!hasChanged) return [3 /*break*/, 3];
|
|
3103
|
-
if (!props.onSelectedItem) return [3 /*break*/, 2];
|
|
3104
|
-
return [4 /*yield*/, props.onSelectedItem({ selectedRows: selectedRows, value: value, subComponentValue: subComponentValue })];
|
|
3105
|
-
case 1:
|
|
3106
|
-
_a.sent();
|
|
3107
|
-
return [3 /*break*/, 3];
|
|
3108
|
-
case 2:
|
|
3109
|
-
selectedRows.forEach(function (row) { return (row[field] = value); });
|
|
3110
|
-
_a.label = 3;
|
|
3111
|
-
case 3: return [2 /*return*/, true];
|
|
3127
|
+
case 0: return [4 /*yield*/, selectItemHandler(value, subComponentValue)];
|
|
3128
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3112
3129
|
}
|
|
3113
3130
|
});
|
|
3114
3131
|
}); }, reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)];
|
|
3115
3132
|
});
|
|
3116
|
-
}); }, [
|
|
3133
|
+
}); }, [selectItemHandler, updateValue]);
|
|
3117
3134
|
var selectFilterHandler = react.useCallback(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3118
3135
|
return __generator(this, function (_a) {
|
|
3119
3136
|
return [2 /*return*/, updateValue(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3153,14 +3170,13 @@ var GridFormDropDown = function (props) {
|
|
|
3153
3170
|
_a.label = 2;
|
|
3154
3171
|
case 2:
|
|
3155
3172
|
optionsList = optionsConf === null || optionsConf === void 0 ? void 0 : optionsConf.map(function (item) {
|
|
3156
|
-
|
|
3157
|
-
|
|
3173
|
+
return item == null || typeof item == "string"
|
|
3174
|
+
? {
|
|
3158
3175
|
value: item,
|
|
3159
3176
|
label: item,
|
|
3160
3177
|
disabled: false
|
|
3161
|
-
}
|
|
3162
|
-
|
|
3163
|
-
return item;
|
|
3178
|
+
}
|
|
3179
|
+
: item;
|
|
3164
3180
|
});
|
|
3165
3181
|
if (props.filtered) {
|
|
3166
3182
|
// This is needed otherwise when filter input is rendered and sets autofocus
|
|
@@ -3205,6 +3221,9 @@ var GridFormDropDown = function (props) {
|
|
|
3205
3221
|
researchOnFilterChange().then();
|
|
3206
3222
|
}
|
|
3207
3223
|
}, [filter, props, researchOnFilterChange]);
|
|
3224
|
+
/**
|
|
3225
|
+
* Saves are wrapped in updateValue and triggered by blur events
|
|
3226
|
+
*/
|
|
3208
3227
|
var save = react.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3209
3228
|
var activeOptions;
|
|
3210
3229
|
return __generator(this, function (_a) {
|
|
@@ -3272,7 +3291,7 @@ var GridFormDropDown = function (props) {
|
|
|
3272
3291
|
e.keepOpen = true;
|
|
3273
3292
|
}
|
|
3274
3293
|
else {
|
|
3275
|
-
|
|
3294
|
+
clickItemHandler(item.value, undefined, e.key === "Tab"
|
|
3276
3295
|
? e.shiftKey
|
|
3277
3296
|
? CloseReason.TAB_BACKWARD
|
|
3278
3297
|
: CloseReason.TAB_FORWARD
|
|
@@ -3464,8 +3483,6 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3464
3483
|
var _a = useGridPopoverContext(), selectedRows = _a.selectedRows, updateValue = _a.updateValue, data = _a.data;
|
|
3465
3484
|
var optionsInitialising = react.useRef(false);
|
|
3466
3485
|
var _b = react.useState(), options = _b[0], setOptions = _b[1];
|
|
3467
|
-
// Save triggers during async action processing which triggers another action(), this ref blocks that
|
|
3468
|
-
var actionProcessing = react.useRef(false);
|
|
3469
3486
|
var _c = react.useState(null), subComponentSelected = _c[0], setSubComponentSelected = _c[1];
|
|
3470
3487
|
var subComponentIsValid = react.useRef(false);
|
|
3471
3488
|
var _d = react.useState(), subSelectedValue = _d[0], setSubSelectedValue = _d[1];
|
|
@@ -3522,26 +3539,20 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3522
3539
|
});
|
|
3523
3540
|
}); })();
|
|
3524
3541
|
}, [options, props.defaultAction, props.options, selectedRows]);
|
|
3525
|
-
var actionClick = react.useCallback(function (menuOption
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
_b.sent();
|
|
3538
|
-
actionProcessing.current = false;
|
|
3539
|
-
return [2 /*return*/, true];
|
|
3540
|
-
}
|
|
3541
|
-
});
|
|
3542
|
-
}); }, reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)];
|
|
3542
|
+
var actionClick = react.useCallback(function (menuOption) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3543
|
+
var result;
|
|
3544
|
+
var _a;
|
|
3545
|
+
return __generator(this, function (_b) {
|
|
3546
|
+
switch (_b.label) {
|
|
3547
|
+
case 0:
|
|
3548
|
+
result = __assign(__assign({}, menuOption), { subValue: subSelectedValue });
|
|
3549
|
+
return [4 /*yield*/, ((_a = menuOption.action) !== null && _a !== void 0 ? _a : defaultAction)(selectedRows, result)];
|
|
3550
|
+
case 1:
|
|
3551
|
+
_b.sent();
|
|
3552
|
+
return [2 /*return*/, true];
|
|
3553
|
+
}
|
|
3543
3554
|
});
|
|
3544
|
-
}); }, [defaultAction, selectedRows, subSelectedValue
|
|
3555
|
+
}); }, [defaultAction, selectedRows, subSelectedValue]);
|
|
3545
3556
|
var onMenuItemClick = react.useCallback(function (e, item) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3546
3557
|
return __generator(this, function (_a) {
|
|
3547
3558
|
switch (_a.label) {
|
|
@@ -3552,27 +3563,29 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3552
3563
|
setSubComponentSelected(subComponentSelected === item ? null : item);
|
|
3553
3564
|
e.keepOpen = true;
|
|
3554
3565
|
return [3 /*break*/, 3];
|
|
3555
|
-
case 1: return [4 /*yield*/,
|
|
3566
|
+
case 1: return [4 /*yield*/, updateValue(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3567
|
+
return [2 /*return*/, actionClick(item)];
|
|
3568
|
+
}); }); }, e.key === "Tab" ? (e.shiftKey ? -1 : 1) : 0)];
|
|
3556
3569
|
case 2:
|
|
3557
3570
|
_a.sent();
|
|
3558
3571
|
_a.label = 3;
|
|
3559
3572
|
case 3: return [2 /*return*/];
|
|
3560
3573
|
}
|
|
3561
3574
|
});
|
|
3562
|
-
}); }, [actionClick, subComponentSelected]);
|
|
3575
|
+
}); }, [actionClick, subComponentSelected, updateValue]);
|
|
3563
3576
|
var save = react.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3564
3577
|
return __generator(this, function (_a) {
|
|
3565
3578
|
switch (_a.label) {
|
|
3566
3579
|
case 0:
|
|
3567
|
-
if (!
|
|
3580
|
+
if (!subComponentSelected) return [3 /*break*/, 2];
|
|
3568
3581
|
if (!subComponentIsValid.current)
|
|
3569
3582
|
return [2 /*return*/, false];
|
|
3570
|
-
return [4 /*yield*/, actionClick(subComponentSelected
|
|
3583
|
+
return [4 /*yield*/, actionClick(subComponentSelected)];
|
|
3571
3584
|
case 1:
|
|
3572
3585
|
_a.sent();
|
|
3573
|
-
|
|
3586
|
+
_a.label = 2;
|
|
3574
3587
|
case 2:
|
|
3575
|
-
//
|
|
3588
|
+
// Close the menu
|
|
3576
3589
|
return [2 /*return*/, true];
|
|
3577
3590
|
}
|
|
3578
3591
|
});
|
|
@@ -3632,7 +3645,7 @@ var bearingNumberParser = function (value) {
|
|
|
3632
3645
|
return parseFloat(value);
|
|
3633
3646
|
};
|
|
3634
3647
|
var validMaskForDmsBearing = /^((-)?\d+)?(\.([0-5](\d([0-5](\d(\d+)?)?)?)?)?)?$/;
|
|
3635
|
-
var bearingStringValidator = function (value,
|
|
3648
|
+
var bearingStringValidator = function (value, customInvalid) {
|
|
3636
3649
|
value = value.trim();
|
|
3637
3650
|
if (value === "")
|
|
3638
3651
|
return null;
|
|
@@ -3644,7 +3657,7 @@ var bearingStringValidator = function (value, customValidate) {
|
|
|
3644
3657
|
return "Bearing has a maximum of 5 decimal places";
|
|
3645
3658
|
}
|
|
3646
3659
|
var bearing = parseFloat(value);
|
|
3647
|
-
return
|
|
3660
|
+
return customInvalid ? customInvalid(bearing) : null;
|
|
3648
3661
|
};
|
|
3649
3662
|
// Decimal-ish degrees to Degrees Minutes Seconds converter
|
|
3650
3663
|
var convertDDToDMS = function (dd, showPositiveSymbol, addTrailingZeros) {
|
|
@@ -3907,8 +3920,11 @@ var TextInputValidator = function (props, value, data) {
|
|
|
3907
3920
|
if (props.maxLength && value.length > props.maxLength) {
|
|
3908
3921
|
return "Text must be no longer than ".concat(props.maxLength, " characters");
|
|
3909
3922
|
}
|
|
3910
|
-
if (props.
|
|
3911
|
-
return props.
|
|
3923
|
+
if (props.maxBytes && new TextEncoder().encode(value).length > props.maxBytes) {
|
|
3924
|
+
return "Text must be no longer than ".concat(props.maxLength, " bytes");
|
|
3925
|
+
}
|
|
3926
|
+
if (props.invalid) {
|
|
3927
|
+
return props.invalid(value, data);
|
|
3912
3928
|
}
|
|
3913
3929
|
return null;
|
|
3914
3930
|
};
|