@linzjs/step-ag-grid 5.0.0 → 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.
@@ -2,13 +2,13 @@
2
2
  import "../../styles/GridFormDropDown.scss";
3
3
  import { GridBaseRow } from "../Grid";
4
4
  import { CellEditorCommon } from "../GridCell";
5
- export interface GridPopoutEditDropDownSelectedItem<RowType, ValueType> {
5
+ export interface GridPopoutEditDropDownSelectedItem<RowType> {
6
6
  selectedRows: RowType[];
7
- value: ValueType;
8
- subComponentValue?: ValueType;
7
+ value: any;
8
+ subComponentValue?: any;
9
9
  }
10
- interface FinalSelectOption<ValueType> {
11
- value: ValueType;
10
+ interface FinalSelectOption {
11
+ value: any;
12
12
  label?: JSX.Element | string;
13
13
  disabled?: boolean | string;
14
14
  subComponent?: (props: any, ref: any) => any;
@@ -22,15 +22,15 @@ export declare const MenuHeaderItem: (title: string) => {
22
22
  label: string;
23
23
  value: string;
24
24
  };
25
- export type SelectOption<ValueType> = ValueType | FinalSelectOption<ValueType>;
26
- export interface GridFormPopoutDropDownProps<RowType extends GridBaseRow, ValueType> extends CellEditorCommon {
25
+ export type SelectOption = null | string | FinalSelectOption;
26
+ export interface GridFormPopoutDropDownProps<RowType extends GridBaseRow> extends CellEditorCommon {
27
27
  className?: "GridPopoverEditDropDown-containerSmall" | "GridPopoverEditDropDown-containerMedium" | "GridPopoverEditDropDown-containerLarge" | "GridPopoverEditDropDown-containerUnlimited" | string | undefined;
28
28
  filtered?: "local" | "reload";
29
29
  filterPlaceholder?: string;
30
- onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<RowType, ValueType>) => Promise<void>;
31
- onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<RowType, string>) => Promise<void>;
32
- options: SelectOption<ValueType>[] | ((selectedRows: RowType[], filter?: string) => Promise<SelectOption<ValueType>[]> | SelectOption<ValueType>[]);
30
+ onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<RowType>) => Promise<void>;
31
+ onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<RowType>) => Promise<void>;
32
+ options: SelectOption[] | ((selectedRows: RowType[], filter?: string) => Promise<SelectOption[]> | SelectOption[]);
33
33
  optionsRequestCancel?: () => void;
34
34
  }
35
- export declare const GridFormDropDown: <RowType extends GridBaseRow, ValueType>(props: GridFormPopoutDropDownProps<RowType, ValueType>) => JSX.Element;
35
+ export declare const GridFormDropDown: <RowType extends GridBaseRow>(props: GridFormPopoutDropDownProps<RowType>) => JSX.Element;
36
36
  export {};
@@ -2,4 +2,4 @@ import { ColDefT, GenericCellEditorProps } from "../GridCell";
2
2
  import { GridBaseRow } from "../Grid";
3
3
  import { GridFormPopoutDropDownProps } from "../gridForm/GridFormDropDown";
4
4
  import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
5
- export declare const GridPopoverEditDropDown: <RowType extends GridBaseRow, ValueType>(colDef: GenericCellColDef<RowType>, props: GenericCellEditorProps<GridFormPopoutDropDownProps<RowType, ValueType>>) => ColDefT<RowType>;
5
+ export declare const GridPopoverEditDropDown: <RowType extends GridBaseRow>(colDef: GenericCellColDef<RowType>, props: GenericCellEditorProps<GridFormPopoutDropDownProps<RowType>>) => ColDefT<RowType>;
@@ -21,8 +21,7 @@ export interface GridContextType {
21
21
  updatingCells: (props: {
22
22
  selectedRows: GridBaseRow[];
23
23
  field?: string;
24
- }, fnUpdate: (selectedRows: any[]) => Promise<boolean>, setSaving?: (saving: boolean) => void) => Promise<boolean>;
24
+ }, fnUpdate: (selectedRows: any[]) => Promise<boolean>, setSaving?: (saving: boolean) => void, tabDirection?: 1 | 0 | -1) => Promise<boolean>;
25
25
  redrawRows: (rowNodes?: RowNode[]) => void;
26
- selectNextCell: (tabDirection: -1 | 0 | 1) => void;
27
26
  }
28
27
  export declare const GridContext: import("react").Context<GridContextType>;
@@ -2,5 +2,5 @@ import { ValueFormatterParams } from "ag-grid-community/dist/lib/entities/colDef
2
2
  export declare const bearingValueFormatter: (params: ValueFormatterParams) => string;
3
3
  export declare const bearingCorrectionValueFormatter: (params: ValueFormatterParams) => string;
4
4
  export declare const bearingNumberParser: (value: string) => number | null;
5
- export declare const bearingStringValidator: (value: string, customValidate?: ((value: number | null) => string | null) | undefined) => string | null;
5
+ export declare const bearingStringValidator: (value: string, customInvalid?: ((value: number | null) => string | null) | undefined) => string | null;
6
6
  export declare const convertDDToDMS: (dd: number | null, showPositiveSymbol?: boolean, addTrailingZeros?: boolean) => string;
@@ -2,6 +2,7 @@ import { GridBaseRow } from "../components/Grid";
2
2
  export interface TextInputValidatorProps<RowType extends GridBaseRow> {
3
3
  required?: boolean;
4
4
  maxLength?: number;
5
- validate?: (value: string, data: RowType) => string | null;
5
+ maxBytes?: number;
6
+ invalid?: (value: string, data: RowType) => string | null;
6
7
  }
7
8
  export declare const TextInputValidator: <RowType extends GridBaseRow>(props: TextInputValidatorProps<RowType>, value: string | null, data: RowType) => string | null;
@@ -1345,8 +1345,10 @@ var ControlledMenuFr = function (_a, externalRef) {
1345
1345
  // the cell doesn't refresh during update if save is invoked from a native event
1346
1346
  // This doesn't happen in React18
1347
1347
  // To work around it, I invoke the save by clicking on a passed in invisible button ref
1348
- if (saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current)
1348
+ if (saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current) {
1349
+ saveButtonRef.current.setAttribute("data-reason", CloseReason.BLUR);
1349
1350
  saveButtonRef.current.click();
1351
+ }
1350
1352
  else
1351
1353
  safeCall(onClose, { reason: CloseReason.BLUR });
1352
1354
  // If a user clicks on the menu button when a menu is open, we need to close the menu.
@@ -1479,8 +1481,8 @@ var ControlledMenuFr = function (_a, externalRef) {
1479
1481
  thisDocument_1.addEventListener("click", handleScreenEventForCancel, true);
1480
1482
  thisDocument_1.addEventListener("dblclick", handleScreenEventForCancel, true);
1481
1483
  return function () {
1482
- thisDocument_1.addEventListener("keydown", handleKeydownTabAndEnter, true);
1483
- thisDocument_1.addEventListener("keyup", handleKeyupTabAndEnter, true);
1484
+ thisDocument_1.removeEventListener("keydown", handleKeydownTabAndEnter, true);
1485
+ thisDocument_1.removeEventListener("keyup", handleKeyupTabAndEnter, true);
1484
1486
  thisDocument_1.removeEventListener("mousedown", handleScreenEventForSave, true);
1485
1487
  thisDocument_1.removeEventListener("mouseup", handleScreenEventForCancel, true);
1486
1488
  thisDocument_1.removeEventListener("click", handleScreenEventForCancel, true);
@@ -1515,7 +1517,12 @@ var ControlledMenuFr = function (_a, externalRef) {
1515
1517
  safeCall(onClose, {
1516
1518
  value: event.value,
1517
1519
  key: event.key,
1518
- reason: CloseReason.CLICK
1520
+ shiftKey: event.shiftKey,
1521
+ reason: event.key === "Tab"
1522
+ ? event.shiftKey
1523
+ ? CloseReason.TAB_BACKWARD
1524
+ : CloseReason.TAB_FORWARD
1525
+ : CloseReason.CLICK
1519
1526
  });
1520
1527
  }
1521
1528
  },
@@ -1984,9 +1991,6 @@ var GridContext = createContext({
1984
1991
  }); },
1985
1992
  redrawRows: function () {
1986
1993
  console.error("no context provider for redrawRows");
1987
- },
1988
- selectNextCell: function () {
1989
- console.error("no context provider for selectNextCell");
1990
1994
  }
1991
1995
  });
1992
1996
 
@@ -2206,17 +2210,18 @@ var GridContextProvider = function (props) {
2206
2210
  });
2207
2211
  };
2208
2212
  var stopEditing = function () { return gridApiOp(function (gridApi) { return gridApi.stopEditing(); }); };
2209
- var updatingCells = function (props, fnUpdate, setSaving) { return __awaiter(void 0, void 0, void 0, function () {
2213
+ var updatingCells = function (props, fnUpdate, setSaving, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
2210
2214
  return __generator(this, function (_a) {
2211
2215
  switch (_a.label) {
2212
2216
  case 0:
2213
2217
  setSaving && setSaving(true);
2214
2218
  return [4 /*yield*/, gridApiOp(function (gridApi) { return __awaiter(void 0, void 0, void 0, function () {
2215
- var selectedRows, ok, cell;
2219
+ var preOpCell, selectedRows, ok, cell, postOpCell;
2216
2220
  var _a;
2217
2221
  return __generator(this, function (_b) {
2218
2222
  switch (_b.label) {
2219
2223
  case 0:
2224
+ preOpCell = gridApi.getFocusedCell();
2220
2225
  selectedRows = props.selectedRows;
2221
2226
  ok = false;
2222
2227
  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 () {
@@ -2248,6 +2253,14 @@ var GridContextProvider = function (props) {
2248
2253
  // Don't set saving if ok as the form has already closed
2249
2254
  setSaving && setSaving(false);
2250
2255
  }
2256
+ postOpCell = gridApi.getFocusedCell();
2257
+ if (tabDirection &&
2258
+ preOpCell &&
2259
+ postOpCell &&
2260
+ preOpCell.rowIndex == postOpCell.rowIndex &&
2261
+ preOpCell.column.getColId() == postOpCell.column.getColId()) {
2262
+ selectNextCell(tabDirection);
2263
+ }
2251
2264
  return [2 /*return*/, ok];
2252
2265
  }
2253
2266
  });
@@ -2288,8 +2301,7 @@ var GridContextProvider = function (props) {
2288
2301
  sizeColumnsToFit: sizeColumnsToFit,
2289
2302
  stopEditing: stopEditing,
2290
2303
  updatingCells: updatingCells,
2291
- redrawRows: redrawRows,
2292
- selectNextCell: selectNextCell
2304
+ redrawRows: redrawRows
2293
2305
  } }, { children: props.children })));
2294
2306
  };
2295
2307
 
@@ -2354,8 +2366,9 @@ var useGridPopoverContext = function () {
2354
2366
  var GridPopoverContextProvider = function (_a) {
2355
2367
  var _b, _c, _d;
2356
2368
  var props = _a.props, children = _a.children;
2357
- var _e = useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells, stopEditing = _e.stopEditing, selectNextCell = _e.selectNextCell;
2369
+ var _e = useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells;
2358
2370
  var anchorRef = useRef(props.eGridCell);
2371
+ var hasSaved = useRef(false);
2359
2372
  var _f = useState(false), saving = _f[0], setSaving = _f[1];
2360
2373
  var colDef = props.colDef;
2361
2374
  var cellEditorParams = colDef.cellEditorParams;
@@ -2364,24 +2377,27 @@ var GridPopoverContextProvider = function (_a) {
2364
2377
  var selectedRows = useMemo(function () { return (multiEdit ? sortBy(getSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data]); }, [getSelectedRows, multiEdit, props.data]);
2365
2378
  var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
2366
2379
  var updateValue = useCallback(function (saveFn, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
2367
- var result;
2368
- return __generator(this, function (_a) {
2369
- switch (_a.label) {
2380
+ var r, _a;
2381
+ return __generator(this, function (_b) {
2382
+ switch (_b.label) {
2370
2383
  case 0:
2371
- result = false;
2372
- if (!!saving) return [3 /*break*/, 2];
2373
- return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving)];
2374
- case 1:
2375
- result = _a.sent();
2376
- if (result) {
2377
- stopEditing();
2378
- tabDirection && selectNextCell(tabDirection);
2379
- }
2380
- _a.label = 2;
2381
- case 2: return [2 /*return*/, result];
2384
+ if (hasSaved.current)
2385
+ return [2 /*return*/, true];
2386
+ hasSaved.current = true;
2387
+ if (!saving) return [3 /*break*/, 1];
2388
+ _a = false;
2389
+ return [3 /*break*/, 3];
2390
+ case 1: return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving, tabDirection)];
2391
+ case 2:
2392
+ _a = _b.sent();
2393
+ _b.label = 3;
2394
+ case 3:
2395
+ r = _a;
2396
+ //if (r) stopEditing();
2397
+ return [2 /*return*/, r];
2382
2398
  }
2383
2399
  });
2384
- }); }, [field, saving, selectNextCell, selectedRows, stopEditing, updatingCells]);
2400
+ }); }, [field, saving, selectedRows, updatingCells]);
2385
2401
  return (jsx(GridPopoverContext.Provider, __assign({ value: {
2386
2402
  anchorRef: anchorRef,
2387
2403
  saving: saving,
@@ -2913,7 +2929,7 @@ var useGridPopoverHook = function (props) {
2913
2929
  return __generator(this, function (_a) {
2914
2930
  switch (_a.label) {
2915
2931
  case 0:
2916
- if (reason == "cancel") {
2932
+ if (reason == CloseReason.CANCEL) {
2917
2933
  stopEditing();
2918
2934
  return [2 /*return*/];
2919
2935
  }
@@ -2942,7 +2958,7 @@ var useGridPopoverHook = function (props) {
2942
2958
  var popoverWrapper = useCallback(function (children) {
2943
2959
  return (jsx(Fragment$1, { children: anchorRef.current && (jsxs(ControlledMenu, __assign({ state: isOpen ? "open" : "closed", portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: "step-ag-grid-react-menu", onClose: function (event) {
2944
2960
  // Prevent menu from closing when modals are invoked
2945
- if (event.reason === "blur")
2961
+ if (event.reason === CloseReason.BLUR)
2946
2962
  return;
2947
2963
  triggerSave(event.reason).then();
2948
2964
  }, viewScroll: "auto", dontShrinkIfDirectionIsTop: true, className: props.className, closeMenuExclusionClassName: "ReactModal__Content" }, { children: [saving && ( // This is the overlay that prevents editing when the editor is saving
@@ -3073,7 +3089,6 @@ var fieldToString = function (field) {
3073
3089
  var GridFormDropDown = function (props) {
3074
3090
  var _a = useGridPopoverContext(), selectedRows = _a.selectedRows, field = _a.field, updateValue = _a.updateValue, data = _a.data;
3075
3091
  // Save triggers during async action processing which triggers another selectItem(), this ref blocks that
3076
- var hasSubmitted = useRef(false);
3077
3092
  var _b = useState(""), filter = _b[0], setFilter = _b[1];
3078
3093
  var _c = useState([]), filteredValues = _c[0], setFilteredValues = _c[1];
3079
3094
  var optionsInitialising = useRef(false);
@@ -3081,32 +3096,39 @@ var GridFormDropDown = function (props) {
3081
3096
  var subComponentIsValid = useRef(false);
3082
3097
  var _e = useState(), subSelectedValue = _e[0], setSubSelectedValue = _e[1];
3083
3098
  var _f = useState(null), selectedSubComponent = _f[0], setSelectedSubComponent = _f[1];
3084
- var selectItemHandler = useCallback(function (value, subComponentValue, reason) { return __awaiter(void 0, void 0, void 0, function () {
3099
+ var selectItemHandler = useCallback(function (value, subComponentValue) { return __awaiter(void 0, void 0, void 0, function () {
3100
+ var hasChanged;
3085
3101
  return __generator(this, function (_a) {
3086
- if (hasSubmitted.current || (subComponentValue !== undefined && !subComponentIsValid.current))
3102
+ switch (_a.label) {
3103
+ case 0:
3104
+ hasChanged = selectedRows.some(function (row) { return row[field] !== value; });
3105
+ if (!hasChanged) return [3 /*break*/, 3];
3106
+ if (!props.onSelectedItem) return [3 /*break*/, 2];
3107
+ return [4 /*yield*/, props.onSelectedItem({ selectedRows: selectedRows, value: value, subComponentValue: subComponentValue })];
3108
+ case 1:
3109
+ _a.sent();
3110
+ return [3 /*break*/, 3];
3111
+ case 2:
3112
+ selectedRows.forEach(function (row) { return (row[field] = value); });
3113
+ _a.label = 3;
3114
+ case 3: return [2 /*return*/, true];
3115
+ }
3116
+ });
3117
+ }); }, [field, props, selectedRows]);
3118
+ var clickItemHandler = useCallback(function (value, subComponentValue, reason) { return __awaiter(void 0, void 0, void 0, function () {
3119
+ return __generator(this, function (_a) {
3120
+ if (subComponentValue !== undefined && !subComponentIsValid.current)
3087
3121
  return [2 /*return*/, false];
3088
- hasSubmitted.current = true;
3089
- return [2 /*return*/, updateValue(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
3090
- var hasChanged;
3122
+ return [2 /*return*/, updateValue(function () { return __awaiter(void 0, void 0, void 0, function () {
3091
3123
  return __generator(this, function (_a) {
3092
3124
  switch (_a.label) {
3093
- case 0:
3094
- hasChanged = selectedRows.some(function (row) { return row[field] !== value; });
3095
- if (!hasChanged) return [3 /*break*/, 3];
3096
- if (!props.onSelectedItem) return [3 /*break*/, 2];
3097
- return [4 /*yield*/, props.onSelectedItem({ selectedRows: selectedRows, value: value, subComponentValue: subComponentValue })];
3098
- case 1:
3099
- _a.sent();
3100
- return [3 /*break*/, 3];
3101
- case 2:
3102
- selectedRows.forEach(function (row) { return (row[field] = value); });
3103
- _a.label = 3;
3104
- case 3: return [2 /*return*/, true];
3125
+ case 0: return [4 /*yield*/, selectItemHandler(value, subComponentValue)];
3126
+ case 1: return [2 /*return*/, _a.sent()];
3105
3127
  }
3106
3128
  });
3107
3129
  }); }, reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)];
3108
3130
  });
3109
- }); }, [field, props, updateValue]);
3131
+ }); }, [selectItemHandler, updateValue]);
3110
3132
  var selectFilterHandler = useCallback(function (value) { return __awaiter(void 0, void 0, void 0, function () {
3111
3133
  return __generator(this, function (_a) {
3112
3134
  return [2 /*return*/, updateValue(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
@@ -3146,14 +3168,13 @@ var GridFormDropDown = function (props) {
3146
3168
  _a.label = 2;
3147
3169
  case 2:
3148
3170
  optionsList = optionsConf === null || optionsConf === void 0 ? void 0 : optionsConf.map(function (item) {
3149
- if (item == null || typeof item == "string" || typeof item == "number") {
3150
- item = {
3171
+ return item == null || typeof item == "string"
3172
+ ? {
3151
3173
  value: item,
3152
3174
  label: item,
3153
3175
  disabled: false
3154
- };
3155
- }
3156
- return item;
3176
+ }
3177
+ : item;
3157
3178
  });
3158
3179
  if (props.filtered) {
3159
3180
  // This is needed otherwise when filter input is rendered and sets autofocus
@@ -3198,6 +3219,9 @@ var GridFormDropDown = function (props) {
3198
3219
  researchOnFilterChange().then();
3199
3220
  }
3200
3221
  }, [filter, props, researchOnFilterChange]);
3222
+ /**
3223
+ * Saves are wrapped in updateValue and triggered by blur events
3224
+ */
3201
3225
  var save = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
3202
3226
  var activeOptions;
3203
3227
  return __generator(this, function (_a) {
@@ -3265,7 +3289,7 @@ var GridFormDropDown = function (props) {
3265
3289
  e.keepOpen = true;
3266
3290
  }
3267
3291
  else {
3268
- selectItemHandler(item.value, undefined, e.key === "Tab"
3292
+ clickItemHandler(item.value, undefined, e.key === "Tab"
3269
3293
  ? e.shiftKey
3270
3294
  ? CloseReason.TAB_BACKWARD
3271
3295
  : CloseReason.TAB_FORWARD
@@ -3457,8 +3481,6 @@ var GridFormPopoverMenu = function (props) {
3457
3481
  var _a = useGridPopoverContext(), selectedRows = _a.selectedRows, updateValue = _a.updateValue, data = _a.data;
3458
3482
  var optionsInitialising = useRef(false);
3459
3483
  var _b = useState(), options = _b[0], setOptions = _b[1];
3460
- // Save triggers during async action processing which triggers another action(), this ref blocks that
3461
- var actionProcessing = useRef(false);
3462
3484
  var _c = useState(null), subComponentSelected = _c[0], setSubComponentSelected = _c[1];
3463
3485
  var subComponentIsValid = useRef(false);
3464
3486
  var _d = useState(), subSelectedValue = _d[0], setSubSelectedValue = _d[1];
@@ -3515,26 +3537,20 @@ var GridFormPopoverMenu = function (props) {
3515
3537
  });
3516
3538
  }); })();
3517
3539
  }, [options, props.defaultAction, props.options, selectedRows]);
3518
- var actionClick = useCallback(function (menuOption, reason) { return __awaiter(void 0, void 0, void 0, function () {
3519
- return __generator(this, function (_a) {
3520
- actionProcessing.current = true;
3521
- return [2 /*return*/, updateValue(function () { return __awaiter(void 0, void 0, void 0, function () {
3522
- var result;
3523
- var _a;
3524
- return __generator(this, function (_b) {
3525
- switch (_b.label) {
3526
- case 0:
3527
- result = __assign(__assign({}, menuOption), { subValue: subSelectedValue });
3528
- return [4 /*yield*/, ((_a = menuOption.action) !== null && _a !== void 0 ? _a : defaultAction)(selectedRows, result)];
3529
- case 1:
3530
- _b.sent();
3531
- actionProcessing.current = false;
3532
- return [2 /*return*/, true];
3533
- }
3534
- });
3535
- }); }, reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)];
3540
+ var actionClick = useCallback(function (menuOption) { return __awaiter(void 0, void 0, void 0, function () {
3541
+ var result;
3542
+ var _a;
3543
+ return __generator(this, function (_b) {
3544
+ switch (_b.label) {
3545
+ case 0:
3546
+ result = __assign(__assign({}, menuOption), { subValue: subSelectedValue });
3547
+ return [4 /*yield*/, ((_a = menuOption.action) !== null && _a !== void 0 ? _a : defaultAction)(selectedRows, result)];
3548
+ case 1:
3549
+ _b.sent();
3550
+ return [2 /*return*/, true];
3551
+ }
3536
3552
  });
3537
- }); }, [defaultAction, selectedRows, subSelectedValue, updateValue]);
3553
+ }); }, [defaultAction, selectedRows, subSelectedValue]);
3538
3554
  var onMenuItemClick = useCallback(function (e, item) { return __awaiter(void 0, void 0, void 0, function () {
3539
3555
  return __generator(this, function (_a) {
3540
3556
  switch (_a.label) {
@@ -3545,27 +3561,29 @@ var GridFormPopoverMenu = function (props) {
3545
3561
  setSubComponentSelected(subComponentSelected === item ? null : item);
3546
3562
  e.keepOpen = true;
3547
3563
  return [3 /*break*/, 3];
3548
- case 1: return [4 /*yield*/, actionClick(item, e.key === "Tab" ? (e.shiftKey ? CloseReason.TAB_BACKWARD : CloseReason.TAB_FORWARD) : CloseReason.CLICK).then()];
3564
+ case 1: return [4 /*yield*/, updateValue(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
3565
+ return [2 /*return*/, actionClick(item)];
3566
+ }); }); }, e.key === "Tab" ? (e.shiftKey ? -1 : 1) : 0)];
3549
3567
  case 2:
3550
3568
  _a.sent();
3551
3569
  _a.label = 3;
3552
3570
  case 3: return [2 /*return*/];
3553
3571
  }
3554
3572
  });
3555
- }); }, [actionClick, subComponentSelected]);
3573
+ }); }, [actionClick, subComponentSelected, updateValue]);
3556
3574
  var save = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
3557
3575
  return __generator(this, function (_a) {
3558
3576
  switch (_a.label) {
3559
3577
  case 0:
3560
- if (!(!actionProcessing.current && subComponentSelected)) return [3 /*break*/, 2];
3578
+ if (!subComponentSelected) return [3 /*break*/, 2];
3561
3579
  if (!subComponentIsValid.current)
3562
3580
  return [2 /*return*/, false];
3563
- return [4 /*yield*/, actionClick(subComponentSelected, "click")];
3581
+ return [4 /*yield*/, actionClick(subComponentSelected)];
3564
3582
  case 1:
3565
3583
  _a.sent();
3566
- return [2 /*return*/, true];
3584
+ _a.label = 2;
3567
3585
  case 2:
3568
- // Otherwise assume it's a cancel, either way we close the menu
3586
+ // Close the menu
3569
3587
  return [2 /*return*/, true];
3570
3588
  }
3571
3589
  });
@@ -3625,7 +3643,7 @@ var bearingNumberParser = function (value) {
3625
3643
  return parseFloat(value);
3626
3644
  };
3627
3645
  var validMaskForDmsBearing = /^((-)?\d+)?(\.([0-5](\d([0-5](\d(\d+)?)?)?)?)?)?$/;
3628
- var bearingStringValidator = function (value, customValidate) {
3646
+ var bearingStringValidator = function (value, customInvalid) {
3629
3647
  value = value.trim();
3630
3648
  if (value === "")
3631
3649
  return null;
@@ -3637,7 +3655,7 @@ var bearingStringValidator = function (value, customValidate) {
3637
3655
  return "Bearing has a maximum of 5 decimal places";
3638
3656
  }
3639
3657
  var bearing = parseFloat(value);
3640
- return customValidate ? customValidate(bearing) : null;
3658
+ return customInvalid ? customInvalid(bearing) : null;
3641
3659
  };
3642
3660
  // Decimal-ish degrees to Degrees Minutes Seconds converter
3643
3661
  var convertDDToDMS = function (dd, showPositiveSymbol, addTrailingZeros) {
@@ -3900,8 +3918,11 @@ var TextInputValidator = function (props, value, data) {
3900
3918
  if (props.maxLength && value.length > props.maxLength) {
3901
3919
  return "Text must be no longer than ".concat(props.maxLength, " characters");
3902
3920
  }
3903
- if (props.validate) {
3904
- return props.validate(value, data);
3921
+ if (props.maxBytes && new TextEncoder().encode(value).length > props.maxBytes) {
3922
+ return "Text must be no longer than ".concat(props.maxLength, " bytes");
3923
+ }
3924
+ if (props.invalid) {
3925
+ return props.invalid(value, data);
3905
3926
  }
3906
3927
  return null;
3907
3928
  };