@linzjs/step-ag-grid 1.5.4 → 2.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.
Files changed (61) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +241 -200
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/components/GridCell.d.ts +18 -27
  5. package/dist/src/components/GridPopoverHook.d.ts +4 -2
  6. package/dist/src/components/gridForm/GridFormDropDown.d.ts +8 -3
  7. package/dist/src/components/gridForm/GridFormEditBearing.d.ts +3 -4
  8. package/dist/src/components/gridForm/GridFormMessage.d.ts +4 -5
  9. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +2 -3
  10. package/dist/src/components/gridForm/GridFormPopoutMenu.d.ts +2 -3
  11. package/dist/src/components/gridForm/GridFormTextArea.d.ts +2 -3
  12. package/dist/src/components/gridForm/GridFormTextInput.d.ts +2 -3
  13. package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +3 -2
  14. package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +5 -270
  15. package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +3 -2
  16. package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +2 -2
  17. package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +3 -2
  18. package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +3 -2
  19. package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +3 -2
  20. package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +1 -3
  21. package/dist/src/contexts/GridPopoverContext.d.ts +17 -0
  22. package/dist/src/contexts/GridPopoverContextProvider.d.ts +6 -0
  23. package/dist/src/contexts/{UpdatingContext.d.ts → GridUpdatingContext.d.ts} +2 -2
  24. package/dist/src/contexts/GridUpdatingContextProvider.d.ts +7 -0
  25. package/dist/src/stories/components/FormTest.d.ts +1 -2
  26. package/dist/step-ag-grid.esm.js +238 -198
  27. package/dist/step-ag-grid.esm.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/Grid.tsx +2 -2
  30. package/src/components/GridCell.tsx +57 -79
  31. package/src/components/GridLoadableCell.tsx +4 -1
  32. package/src/components/GridPopoverHook.tsx +10 -14
  33. package/src/components/gridForm/GridFormDropDown.tsx +41 -30
  34. package/src/components/gridForm/GridFormEditBearing.tsx +13 -13
  35. package/src/components/gridForm/GridFormMessage.tsx +8 -13
  36. package/src/components/gridForm/GridFormMultiSelect.tsx +19 -19
  37. package/src/components/gridForm/GridFormPopoutMenu.tsx +7 -8
  38. package/src/components/gridForm/GridFormTextArea.tsx +16 -17
  39. package/src/components/gridForm/GridFormTextInput.tsx +17 -17
  40. package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +17 -16
  41. package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +53 -45
  42. package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +17 -16
  43. package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +20 -21
  44. package/src/components/gridPopoverEdit/GridPopoverMessage.ts +18 -16
  45. package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +12 -16
  46. package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +15 -15
  47. package/src/components/gridRender/GridRenderGenericCell.tsx +3 -5
  48. package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +2 -2
  49. package/src/contexts/GridContextProvider.tsx +3 -5
  50. package/src/contexts/GridPopoverContext.tsx +32 -0
  51. package/src/contexts/GridPopoverContextProvider.tsx +53 -0
  52. package/src/contexts/{UpdatingContext.tsx → GridUpdatingContext.tsx} +2 -2
  53. package/src/contexts/{UpdatingContextProvider.tsx → GridUpdatingContextProvider.tsx} +8 -6
  54. package/src/stories/components/FormTest.tsx +4 -3
  55. package/src/stories/components/GridPopoutBearing.stories.tsx +28 -25
  56. package/src/stories/components/GridPopoutEditDropDown.stories.tsx +91 -50
  57. package/src/stories/components/GridPopoutEditGeneric.stories.tsx +18 -13
  58. package/src/stories/components/GridPopoutEditGenericTextArea.stories.tsx +76 -61
  59. package/src/stories/components/GridPopoutEditMultiSelect.stories.tsx +58 -51
  60. package/src/stories/components/GridReadOnly.stories.tsx +73 -57
  61. package/dist/src/contexts/UpdatingContextProvider.d.ts +0 -7
@@ -1632,7 +1632,7 @@ var MenuRadioGroupFr = function (_a, externalRef) {
1632
1632
  };
1633
1633
  var MenuRadioGroup = forwardRef(MenuRadioGroupFr);
1634
1634
 
1635
- var UpdatingContext = createContext({
1635
+ var GridUpdatingContext = createContext({
1636
1636
  checkUpdating: function () {
1637
1637
  console.error("Missing UpdatingContext");
1638
1638
  return false;
@@ -1645,7 +1645,7 @@ var UpdatingContext = createContext({
1645
1645
  }); }
1646
1646
  });
1647
1647
 
1648
- var UpdatingContextProvider = function (props) {
1648
+ var GridUpdatingContextProvider = function (props) {
1649
1649
  var updatingBlocks = useRef({});
1650
1650
  var updating = useRef({});
1651
1651
  var resetUpdating = function () {
@@ -1677,7 +1677,7 @@ var UpdatingContextProvider = function (props) {
1677
1677
  var checkUpdating = function (fields, id) {
1678
1678
  return castArray(fields).some(function (f) { var _a; return (_a = updating.current[f]) === null || _a === void 0 ? void 0 : _a.includes(id); });
1679
1679
  };
1680
- return (jsx(UpdatingContext.Provider, __assign({ value: { modifyUpdating: modifyUpdating, checkUpdating: checkUpdating } }, { children: props.children })));
1680
+ return (jsx(GridUpdatingContext.Provider, __assign({ value: { modifyUpdating: modifyUpdating, checkUpdating: checkUpdating } }, { children: props.children })));
1681
1681
  };
1682
1682
 
1683
1683
  var GridContext = createContext({
@@ -1756,7 +1756,7 @@ var GridContext = createContext({
1756
1756
  * Also, make sure the provider is created in a separate component, otherwise it won't be found.
1757
1757
  */
1758
1758
  var GridContextProvider = function (props) {
1759
- var modifyUpdating = useContext(UpdatingContext).modifyUpdating;
1759
+ var modifyUpdating = useContext(GridUpdatingContext).modifyUpdating;
1760
1760
  var gridApiRef = useRef();
1761
1761
  var idsBeforeUpdate = useRef([]);
1762
1762
  /**
@@ -1782,10 +1782,7 @@ var GridContextProvider = function (props) {
1782
1782
  noApiFn = (function () { });
1783
1783
  }
1784
1784
  var gridApi = gridApiRef.current;
1785
- if (gridApi)
1786
- return hasApiFn(gridApi);
1787
- console.error("GridApi not ready");
1788
- return noApiFn();
1785
+ return gridApi ? hasApiFn(gridApi) : noApiFn();
1789
1786
  };
1790
1787
  /**
1791
1788
  * Set the quick filter value to grid.
@@ -2206,7 +2203,7 @@ var GridHeaderSelect = function (_a) {
2206
2203
  var Grid = function (params) {
2207
2204
  var _a;
2208
2205
  var _b = useContext(GridContext), gridReady = _b.gridReady, setGridApi = _b.setGridApi, setQuickFilter = _b.setQuickFilter, ensureRowVisible = _b.ensureRowVisible, selectRowsById = _b.selectRowsById, ensureSelectedRowIsVisible = _b.ensureSelectedRowIsVisible, sizeColumnsToFit = _b.sizeColumnsToFit;
2209
- var checkUpdating = useContext(UpdatingContext).checkUpdating;
2206
+ var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
2210
2207
  var _c = useState(""), internalQuickFilter = _c[0], setInternalQuickFilter = _c[1];
2211
2208
  var lastSelectedIds = useRef([]);
2212
2209
  var _d = useState(false), staleGrid = _d[0], setStaleGrid = _d[1];
@@ -2379,8 +2376,24 @@ styleInject(css_248z$5);
2379
2376
  var css_248z$4 = ".GridLoadableCell-container {\n display: flex;\n align-items: center;\n}";
2380
2377
  styleInject(css_248z$4);
2381
2378
 
2379
+ var GridPopoverContext = createContext({
2380
+ anchorRef: { current: null },
2381
+ updateValueRef: {
2382
+ current: function () { return __awaiter(void 0, void 0, void 0, function () {
2383
+ return __generator(this, function (_a) {
2384
+ console.error("Missing GridPopoverContext updateValueRef");
2385
+ return [2 /*return*/, false];
2386
+ });
2387
+ }); }
2388
+ },
2389
+ saving: false,
2390
+ setSaving: function () { },
2391
+ setProps: function () { },
2392
+ propsRef: { current: null }
2393
+ });
2394
+
2382
2395
  var GridLoadableCell = function (props) {
2383
- // console.log(`Rendering LoadableCell - loading: ${props.isLoading}`);
2396
+ useContext(GridPopoverContext).saving;
2384
2397
  if (props.isLoading) {
2385
2398
  return (jsx("div", __assign({ style: { display: "flex", alignItems: "center" } }, { children: jsx(LuiMiniSpinner, { size: 22, divProps: { role: "status", "aria-label": "Loading", style: { marginBottom: 4 } } }) })));
2386
2399
  }
@@ -2392,7 +2405,7 @@ var GridIcon = function (props) { return (jsx(LuiIcon, { name: props.icon, title
2392
2405
 
2393
2406
  var GridRendererGenericCell = function (props) {
2394
2407
  var _a, _b, _c;
2395
- var checkUpdating = useContext(UpdatingContext).checkUpdating;
2408
+ var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
2396
2409
  var colDef = props.colDef;
2397
2410
  var cellRendererParams = colDef.cellRendererParams;
2398
2411
  var warningFn = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.warning;
@@ -2409,9 +2422,57 @@ var GridRendererGenericCell = function (props) {
2409
2422
  return (jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((_c = (_b = colDef.field) !== null && _b !== void 0 ? _b : colDef.colId) !== null && _c !== void 0 ? _c : "", props.data.id) }, { children: jsxs(Fragment$1, { children: [typeof warningText === "string" && jsx(GridIcon, { icon: "ic_warning", title: warningText }), typeof infoText === "string" && jsx(GridIcon, { icon: "ic_info", title: infoText }), jsx("span", __assign({ title: formatted }, { children: formatted }))] }) })));
2410
2423
  };
2411
2424
 
2425
+ var GridPopoverContextProvider = function (props) {
2426
+ var _a = useContext(GridContext), getSelectedRows = _a.getSelectedRows, updatingCells = _a.updatingCells;
2427
+ var anchorRef = useRef();
2428
+ var propsRef = useRef({});
2429
+ var updateValueRef = useRef(function () { return __awaiter(void 0, void 0, void 0, function () {
2430
+ return __generator(this, function (_a) {
2431
+ console.error("updateValueRef.current is not set");
2432
+ return [2 /*return*/, false];
2433
+ });
2434
+ }); });
2435
+ var _b = useState(false), saving = _b[0], setSaving = _b[1];
2436
+ var setProps = function (props, multiEdit) {
2437
+ var _a, _b;
2438
+ var selectedRows = multiEdit ? getSelectedRows() : [props.data];
2439
+ var field = (_b = (_a = props.colDef) === null || _a === void 0 ? void 0 : _a.field) !== null && _b !== void 0 ? _b : "";
2440
+ anchorRef.current = props.eGridCell;
2441
+ propsRef.current = {
2442
+ value: props.value,
2443
+ data: props.data,
2444
+ field: field,
2445
+ selectedRows: selectedRows
2446
+ };
2447
+ updateValueRef.current = function (saveFn) { return __awaiter(void 0, void 0, void 0, function () {
2448
+ var _a;
2449
+ return __generator(this, function (_b) {
2450
+ switch (_b.label) {
2451
+ case 0:
2452
+ _a = !saving;
2453
+ if (!_a) return [3 /*break*/, 2];
2454
+ return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving)];
2455
+ case 1:
2456
+ _a = (_b.sent());
2457
+ _b.label = 2;
2458
+ case 2: return [2 /*return*/, _a];
2459
+ }
2460
+ });
2461
+ }); };
2462
+ };
2463
+ return (jsx(GridPopoverContext.Provider, __assign({ value: {
2464
+ anchorRef: anchorRef,
2465
+ saving: saving,
2466
+ setSaving: setSaving,
2467
+ updateValueRef: updateValueRef,
2468
+ propsRef: propsRef,
2469
+ setProps: setProps
2470
+ } }, { children: props.children })));
2471
+ };
2472
+
2412
2473
  var GridCellRenderer = function (props) {
2413
2474
  var _a, _b, _c;
2414
- var checkUpdating = useContext(UpdatingContext).checkUpdating;
2475
+ var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
2415
2476
  var colDef = props.colDef;
2416
2477
  var rendererParams = colDef.cellRendererParams;
2417
2478
  var warningFn = rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.warning;
@@ -2420,15 +2481,17 @@ var GridCellRenderer = function (props) {
2420
2481
  var infoText = infoFn ? infoFn(props) : undefined;
2421
2482
  return ((_a = colDef === null || colDef === void 0 ? void 0 : colDef.cellRendererParams) === null || _a === void 0 ? void 0 : _a.originalCellRenderer) ? (jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((_c = (_b = colDef.field) !== null && _b !== void 0 ? _b : colDef.colId) !== null && _c !== void 0 ? _c : "", props.data.id) }, { children: jsxs(Fragment$1, { children: [typeof warningText === "string" && jsx(GridIcon, { icon: "ic_warning", title: warningText }), typeof infoText === "string" && jsx(GridIcon, { icon: "ic_info", title: infoText }), jsx(colDef.cellRendererParams.originalCellRenderer, __assign({}, props))] }) }))) : (jsx(GridRendererGenericCell, __assign({}, props)));
2422
2483
  };
2423
- /**
2484
+ /*
2424
2485
  * For editing a text area.
2425
2486
  */
2426
- var GridCell = function (props) {
2487
+ var GridCell = function (props, custom) {
2427
2488
  var _a;
2428
- return __assign(__assign(__assign(__assign({ sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, (props.cellEditorParams && {
2429
- cellClass: ((_a = props === null || props === void 0 ? void 0 : props.cellEditorParams) === null || _a === void 0 ? void 0 : _a.multiEdit) ? GenericMultiEditCellClass : undefined,
2430
- editable: true,
2431
- cellEditor: GenericCellEditorComponent
2489
+ return __assign(__assign(__assign(__assign(__assign({ 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) && {
2490
+ cellClass: (custom === null || custom === void 0 ? void 0 : custom.multiEdit) ? GenericMultiEditCellClass : undefined,
2491
+ editable: (_a = props.editable) !== null && _a !== void 0 ? _a : true,
2492
+ cellEditor: GenericCellEditorComponent(custom.editor)
2493
+ })), ((custom === null || custom === void 0 ? void 0 : custom.editorParams) && {
2494
+ cellEditorParams: __assign(__assign({}, custom.editorParams), { multiEdit: custom.multiEdit })
2432
2495
  })), {
2433
2496
  // Default value formatter, otherwise react freaks out on objects
2434
2497
  valueFormatter: function (params) {
@@ -2441,37 +2504,22 @@ var GridCell = function (props) {
2441
2504
  return JSON.stringify(params.value);
2442
2505
  } }), props), { cellRenderer: GridCellRenderer, cellRendererParams: __assign({ originalCellRenderer: props.cellRenderer }, props.cellRendererParams) });
2443
2506
  };
2444
- var GenericCellEditorComponentFr = function (props, _) {
2445
- var _a, _b, _c;
2446
- var _d = useContext(GridContext), updatingCells = _d.updatingCells, getSelectedRows = _d.getSelectedRows;
2447
- var colDef = props.colDef, data = props.data;
2448
- var cellEditorParams = props.colDef.cellEditorParams;
2449
- var multiEdit = (_a = cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.multiEdit) !== null && _a !== void 0 ? _a : false;
2450
- var field = (_b = props.colDef.field) !== null && _b !== void 0 ? _b : "";
2451
- var formProps = (_c = colDef.cellEditorParams) !== null && _c !== void 0 ? _c : {};
2452
- var value = props.value;
2453
- var selectedRows = useMemo(function () { return (multiEdit ? getSelectedRows() : [data]); }, [data, getSelectedRows, multiEdit]);
2454
- var _e = useState(false), saving = _e[0], setSaving = _e[1];
2455
- var updateValue = useCallback(function (saveFn) { return __awaiter(void 0, void 0, void 0, function () {
2456
- var _a;
2457
- return __generator(this, function (_b) {
2458
- switch (_b.label) {
2459
- case 0:
2460
- _a = !saving;
2461
- if (!_a) return [3 /*break*/, 2];
2462
- return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving)];
2463
- case 1:
2464
- _a = (_b.sent());
2465
- _b.label = 2;
2466
- case 2: return [2 /*return*/, _a];
2467
- }
2468
- });
2469
- }); }, [field, saving, selectedRows, updatingCells]);
2470
- if (cellEditorParams == null)
2471
- return jsx(Fragment$1, {});
2472
- return (jsxs(Fragment$1, { children: [jsx("div", { children: colDef.cellRenderer ? jsx(colDef.cellRenderer, __assign({}, props, { saving: saving })) : props.value }), (cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.form) && (jsx(cellEditorParams.form, { cellEditorParams: props, updateValue: updateValue, saving: saving, formProps: formProps, data: data, value: value, field: field, selectedRows: selectedRows }))] }));
2507
+ // TODO memo?
2508
+ var GenericCellEditorComponent = function (editor) {
2509
+ return forwardRef(function GenericCellEditorComponent2(props, _) {
2510
+ return (jsx(GridPopoverContextProvider, { children: jsx(GenericCellEditorComponent3, __assign({}, __assign(__assign({}, props), { editor: editor }))) }));
2511
+ });
2473
2512
  };
2474
- var GenericCellEditorComponent = forwardRef(GenericCellEditorComponentFr);
2513
+ var GenericCellEditorComponent3 = function (props) {
2514
+ var _a;
2515
+ var _b = useContext(GridPopoverContext), setProps = _b.setProps, propsRef = _b.propsRef;
2516
+ var colDef = props.colDef;
2517
+ var cellEditorParams = colDef.cellEditorParams;
2518
+ var multiEdit = (_a = cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.multiEdit) !== null && _a !== void 0 ? _a : false;
2519
+ // TODO don't need all these props in context
2520
+ setProps(props, multiEdit);
2521
+ return (jsxs(Fragment$1, { children: [jsx("div", { children: colDef.cellRenderer ? jsx(colDef.cellRenderer, __assign({}, props)) : props.value }), (props === null || props === void 0 ? void 0 : props.editor) && jsx(props.editor, __assign({}, cellEditorParams, propsRef.current))] }));
2522
+ };
2475
2523
 
2476
2524
  /**
2477
2525
  * If loading is true this returns a loading spinner, otherwise it returns its children.
@@ -2489,29 +2537,32 @@ var ComponentLoadingWrapper = function (props) {
2489
2537
  } })), props.children] })));
2490
2538
  };
2491
2539
 
2492
- var useGridPopoverHook = function (props, save) {
2493
- var cellEditorParams = props.cellEditorParams, saving = props.saving, updateValue = props.updateValue;
2494
- var eGridCell = cellEditorParams.eGridCell;
2540
+ var useGridPopoverHook = function (props) {
2541
+ if (props === void 0) { props = {}; }
2495
2542
  var stopEditing = useContext(GridContext).stopEditing;
2543
+ var _a = useContext(GridPopoverContext), anchorRef = _a.anchorRef, saving = _a.saving, updateValueRef = _a.updateValueRef;
2496
2544
  var saveButtonRef = useRef(null);
2497
- var anchorRef = useRef(eGridCell);
2498
- anchorRef.current = eGridCell;
2499
- var _a = useState(false), isOpen = _a[0], setOpen = _a[1];
2545
+ var _b = useState(false), isOpen = _b[0], setOpen = _b[1];
2500
2546
  useEffect(function () {
2501
2547
  setOpen(true);
2502
2548
  }, []);
2503
2549
  var triggerSave = useCallback(function (reason) { return __awaiter(void 0, void 0, void 0, function () {
2504
- var _a;
2505
- return __generator(this, function (_b) {
2506
- switch (_b.label) {
2550
+ var _a, _b;
2551
+ return __generator(this, function (_c) {
2552
+ switch (_c.label) {
2507
2553
  case 0:
2508
- _a = reason == "cancel" || !save;
2509
- if (_a) return [3 /*break*/, 2];
2510
- return [4 /*yield*/, updateValue(save)];
2554
+ _a = reason == "cancel" || !props.save;
2555
+ if (_a) return [3 /*break*/, 3];
2556
+ _b = updateValueRef.current;
2557
+ if (!_b) return [3 /*break*/, 2];
2558
+ return [4 /*yield*/, updateValueRef.current(props.save)];
2511
2559
  case 1:
2512
- _a = (_b.sent());
2513
- _b.label = 2;
2560
+ _b = (_c.sent());
2561
+ _c.label = 2;
2514
2562
  case 2:
2563
+ _a = (_b);
2564
+ _c.label = 3;
2565
+ case 3:
2515
2566
  if (_a) {
2516
2567
  setOpen(false);
2517
2568
  stopEditing();
@@ -2519,9 +2570,9 @@ var useGridPopoverHook = function (props, save) {
2519
2570
  return [2 /*return*/];
2520
2571
  }
2521
2572
  });
2522
- }); }, [save, stopEditing, updateValue]);
2573
+ }); }, [props, stopEditing, updateValueRef]);
2523
2574
  var popoverWrapper = useCallback(function (children) {
2524
- return (jsx(Fragment$1, { children: anchorRef.current && (jsxs(ControlledMenu, __assign({ state: isOpen ? "open" : "closed", portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: "lui-menu", onClose: function (event) { return triggerSave(event.reason).then(); }, reposition: "initial", viewScroll: "auto", dontShrinkIfDirectionIsTop: true }, { children: [saving && (jsx("div", { style: {
2575
+ return (jsx(Fragment$1, { children: anchorRef.current && (jsxs(ControlledMenu, __assign({ state: isOpen ? "open" : "closed", portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: "lui-menu", onClose: function (event) { return triggerSave(event.reason).then(); }, viewScroll: "auto", dontShrinkIfDirectionIsTop: true }, { children: [saving && (jsx("div", { style: {
2525
2576
  position: "absolute",
2526
2577
  left: 0,
2527
2578
  top: 0,
@@ -2530,7 +2581,7 @@ var useGridPopoverHook = function (props, save) {
2530
2581
  backgroundColor: "rgba(64,64,64,0.1)",
2531
2582
  zIndex: 1000
2532
2583
  } })), children, jsx("button", { ref: saveButtonRef, onClick: function () { return triggerSave().then(); }, style: { display: "none" } })] }))) }));
2533
- }, [isOpen, saving, triggerSave]);
2584
+ }, [anchorRef, isOpen, saving, triggerSave]);
2534
2585
  return {
2535
2586
  popoverWrapper: popoverWrapper,
2536
2587
  triggerSave: triggerSave
@@ -2539,7 +2590,7 @@ var useGridPopoverHook = function (props, save) {
2539
2590
 
2540
2591
  var GridRenderPopoutMenuCell = function (props) {
2541
2592
  var _a, _b, _c;
2542
- var checkUpdating = useContext(UpdatingContext).checkUpdating;
2593
+ var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
2543
2594
  var isLoading = checkUpdating((_b = (_a = props.colDef) === null || _a === void 0 ? void 0 : _a.field) !== null && _b !== void 0 ? _b : "", props.data.id);
2544
2595
  var editable = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.editable;
2545
2596
  var disabled = !(typeof editable === "function"
@@ -2561,9 +2612,12 @@ styleInject(css_248z$3);
2561
2612
 
2562
2613
  var MenuSeparatorString = "_____MENU_SEPARATOR_____";
2563
2614
  var MenuSeparator = Object.freeze({ value: MenuSeparatorString });
2564
- var GridFormDropDown = function (props) {
2565
- var popoverWrapper = useGridPopoverHook(props).popoverWrapper;
2566
- var formProps = props.formProps;
2615
+ var MenuHeaderString = "_____MENU_HEADER_____";
2616
+ var MenuHeaderItem = function (title) {
2617
+ return { label: title, value: MenuHeaderString };
2618
+ };
2619
+ var GridFormDropDown = function (_props) {
2620
+ var props = _props;
2567
2621
  var _a = useContext(GridContext), updatingCells = _a.updatingCells, stopEditing = _a.stopEditing;
2568
2622
  var _b = useState(""), filter = _b[0], setFilter = _b[1];
2569
2623
  var _c = useState([]), filteredValues = _c[0], setFilteredValues = _c[1];
@@ -2582,8 +2636,8 @@ var GridFormDropDown = function (props) {
2582
2636
  case 0:
2583
2637
  hasChanged = selectedRows.some(function (row) { return row[field] !== value; });
2584
2638
  if (!hasChanged) return [3 /*break*/, 3];
2585
- if (!formProps.onSelectedItem) return [3 /*break*/, 2];
2586
- return [4 /*yield*/, formProps.onSelectedItem({ selectedRows: selectedRows, value: value })];
2639
+ if (!props.onSelectedItem) return [3 /*break*/, 2];
2640
+ return [4 /*yield*/, props.onSelectedItem({ selectedRows: selectedRows, value: value })];
2587
2641
  case 1:
2588
2642
  _a.sent();
2589
2643
  return [3 /*break*/, 3];
@@ -2597,7 +2651,7 @@ var GridFormDropDown = function (props) {
2597
2651
  case 1: return [2 /*return*/, _a.sent()];
2598
2652
  }
2599
2653
  });
2600
- }); }, [formProps, props.field, props.selectedRows, updatingCells]);
2654
+ }); }, [props, updatingCells]);
2601
2655
  var selectFilterHandler = useCallback(function (value) { return __awaiter(void 0, void 0, void 0, function () {
2602
2656
  var field;
2603
2657
  return __generator(this, function (_a) {
@@ -2608,8 +2662,8 @@ var GridFormDropDown = function (props) {
2608
2662
  return __generator(this, function (_a) {
2609
2663
  switch (_a.label) {
2610
2664
  case 0:
2611
- if (!formProps.onSelectFilter) return [3 /*break*/, 2];
2612
- return [4 /*yield*/, formProps.onSelectFilter({ selectedRows: selectedRows, value: value })];
2665
+ if (!props.onSelectFilter) return [3 /*break*/, 2];
2666
+ return [4 /*yield*/, props.onSelectFilter({ selectedRows: selectedRows, value: value })];
2613
2667
  case 1:
2614
2668
  _a.sent();
2615
2669
  _a.label = 2;
@@ -2620,14 +2674,14 @@ var GridFormDropDown = function (props) {
2620
2674
  case 1: return [2 /*return*/, _a.sent()];
2621
2675
  }
2622
2676
  });
2623
- }); }, [formProps, props.field, props.selectedRows, updatingCells]);
2677
+ }); }, [props, updatingCells]);
2624
2678
  // Load up options list if it's async function
2625
2679
  useEffect(function () {
2626
2680
  var _a;
2627
2681
  if (options || optionsInitialising.current)
2628
2682
  return;
2629
2683
  optionsInitialising.current = true;
2630
- var optionsConf = (_a = formProps.options) !== null && _a !== void 0 ? _a : [];
2684
+ var optionsConf = (_a = props.options) !== null && _a !== void 0 ? _a : [];
2631
2685
  (function () { return __awaiter(void 0, void 0, void 0, function () {
2632
2686
  var optionsList;
2633
2687
  return __generator(this, function (_a) {
@@ -2645,7 +2699,7 @@ var GridFormDropDown = function (props) {
2645
2699
  }
2646
2700
  return item;
2647
2701
  });
2648
- if (formProps.filtered) {
2702
+ if (props.filtered) {
2649
2703
  // This is needed otherwise when filter input is rendered and sets autofocus
2650
2704
  // the mouse up of the double click edit triggers the cell to cancel editing
2651
2705
  delay(function () { return setOptions(optionsList); }, 100);
@@ -2658,10 +2712,10 @@ var GridFormDropDown = function (props) {
2658
2712
  }
2659
2713
  });
2660
2714
  }); })();
2661
- }, [filter, options, formProps.filtered, formProps.options, props.selectedRows]);
2662
- // Local filtering
2715
+ }, [filter, options, props]);
2716
+ // Local filtering.
2663
2717
  useEffect(function () {
2664
- if (formProps.filtered == "local") {
2718
+ if (props.filtered == "local") {
2665
2719
  if (options == null)
2666
2720
  return;
2667
2721
  setFilteredValues(options
@@ -2675,19 +2729,19 @@ var GridFormDropDown = function (props) {
2675
2729
  })
2676
2730
  .filter(function (r) { return r !== undefined; }));
2677
2731
  }
2678
- }, [formProps.filtered, filter, options]);
2732
+ }, [props.filtered, filter, options]);
2679
2733
  var researchOnFilterChange = debounce(useCallback(function () {
2680
2734
  setOptions(null);
2681
2735
  }, []), 500);
2682
2736
  var previousFilter = useRef(filter);
2683
- // Reload filtering
2737
+ // Reload filtering.
2684
2738
  useEffect(function () {
2685
- if (previousFilter.current != filter && formProps.filtered == "reload") {
2739
+ if (previousFilter.current != filter && props.filtered == "reload") {
2686
2740
  previousFilter.current = filter;
2687
- formProps.optionsRequestCancel && formProps.optionsRequestCancel();
2741
+ props.optionsRequestCancel && props.optionsRequestCancel();
2688
2742
  researchOnFilterChange().then();
2689
2743
  }
2690
- }, [filter, formProps, props, researchOnFilterChange]);
2744
+ }, [filter, props, researchOnFilterChange]);
2691
2745
  var onFilterKeyDown = useCallback(function (e) { return __awaiter(void 0, void 0, void 0, function () {
2692
2746
  var activeOptions;
2693
2747
  return __generator(this, function (_a) {
@@ -2704,7 +2758,7 @@ var GridFormDropDown = function (props) {
2704
2758
  stopEditing();
2705
2759
  return [3 /*break*/, 5];
2706
2760
  case 2:
2707
- if (!formProps.onSelectFilter) return [3 /*break*/, 4];
2761
+ if (!props.onSelectFilter) return [3 /*break*/, 4];
2708
2762
  return [4 /*yield*/, selectFilterHandler(filter)];
2709
2763
  case 3:
2710
2764
  _a.sent();
@@ -2717,26 +2771,28 @@ var GridFormDropDown = function (props) {
2717
2771
  case 5: return [2 /*return*/];
2718
2772
  }
2719
2773
  });
2720
- }); }, [filteredValues, options, selectItemHandler, selectFilterHandler, stopEditing, filter, formProps]);
2721
- return popoverWrapper(jsxs(Fragment$1, { children: [formProps.filtered && (jsxs(Fragment$1, { children: [jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
2774
+ }); }, [filteredValues, options, selectItemHandler, selectFilterHandler, stopEditing, filter, props]);
2775
+ var maxRowsStyles = props.maxRows !== undefined ? { maxHeight: 62 + 34 * props.maxRows, overFlowY: "auto" } : undefined;
2776
+ var popoverWrapper = useGridPopoverHook().popoverWrapper;
2777
+ return popoverWrapper(jsxs(Fragment$1, { children: [props.filtered && (jsxs(Fragment$1, { children: [jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
2722
2778
  var _b;
2723
2779
  var ref = _a.ref;
2724
- return (jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = formProps.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, onChange: function (e) { return setFilter(e.target.value.toLowerCase()); }, onKeyDown: function (e) { return onFilterKeyDown(e); } }) })));
2725
- } })), jsx(MenuDivider, {}, "$$divider_filter")] })), jsx(ComponentLoadingWrapper, __assign({ loading: !options }, { children: jsxs(Fragment$1, { children: [options && options.length == (filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.length) && jsx(MenuItem, { children: "[Empty]" }), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
2780
+ return (jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = props.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, onChange: function (e) { return setFilter(e.target.value.toLowerCase()); }, onKeyDown: function (e) { return onFilterKeyDown(e); } }) })));
2781
+ } })), jsx(MenuDivider, {}, "$$divider_filter")] })), jsx(ComponentLoadingWrapper, __assign({ loading: !options }, { children: jsxs("div", __assign({ style: maxRowsStyles }, { children: [options && options.length == (filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.length) && jsx(MenuItem, { children: "[Empty]" }), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
2726
2782
  var _a;
2727
- return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : filteredValues.includes(item.value) ? null : (jsx(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function () { return selectItemHandler(item.value); } }, { children: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)) }), "".concat(props.field, "-").concat(index)));
2728
- })] }) }))] }));
2783
+ return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsx(MenuHeader, { children: item.label })) : filteredValues.includes(item.value) ? null : (jsx(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function () { return selectItemHandler(item.value); } }, { children: (_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)) }), "".concat(props.field, "-").concat(index)));
2784
+ })] })) }))] }));
2729
2785
  };
2730
2786
 
2731
2787
  var GridFormMultiSelect = function (props) {
2732
- var formProps = props.formProps;
2788
+ var selectedRows = props.selectedRows;
2733
2789
  var _a = useState(""), filter = _a[0], setFilter = _a[1];
2734
2790
  var _b = useState([]), filteredValues = _b[0], setFilteredValues = _b[1];
2735
2791
  var optionsInitialising = useRef(false);
2736
2792
  var _c = useState(), options = _c[0], setOptions = _c[1];
2737
2793
  var subSelectedValues = useRef({});
2738
2794
  var _d = useState(function () {
2739
- return formProps.initialSelectedValues ? formProps.initialSelectedValues(props.selectedRows) : [];
2795
+ return props.initialSelectedValues ? props.initialSelectedValues(selectedRows) : [];
2740
2796
  }), selectedValues = _d[0], setSelectedValues = _d[1];
2741
2797
  var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
2742
2798
  var values;
@@ -2744,28 +2800,28 @@ var GridFormMultiSelect = function (props) {
2744
2800
  switch (_a.label) {
2745
2801
  case 0:
2746
2802
  values = fromPairs(selectedValues.map(function (value) { var _a; return [value, (_a = subSelectedValues.current[value]) !== null && _a !== void 0 ? _a : true]; }));
2747
- if (!formProps.onSave) return [3 /*break*/, 2];
2748
- return [4 /*yield*/, formProps.onSave({ selectedRows: selectedRows, values: values })];
2803
+ if (!props.onSave) return [3 /*break*/, 2];
2804
+ return [4 /*yield*/, props.onSave({ selectedRows: selectedRows, values: values })];
2749
2805
  case 1: return [2 /*return*/, _a.sent()];
2750
2806
  case 2: return [2 /*return*/, true];
2751
2807
  }
2752
2808
  });
2753
- }); }, [formProps, selectedValues]);
2754
- var _e = useGridPopoverHook(props, save), popoverWrapper = _e.popoverWrapper, triggerSave = _e.triggerSave;
2809
+ }); }, [props, selectedValues]);
2810
+ var _e = useGridPopoverHook({ save: save }), popoverWrapper = _e.popoverWrapper, triggerSave = _e.triggerSave;
2755
2811
  // Load up options list if it's async function
2756
2812
  useEffect(function () {
2757
2813
  var _a;
2758
2814
  if (options || optionsInitialising.current)
2759
2815
  return;
2760
2816
  optionsInitialising.current = true;
2761
- var optionsConf = (_a = formProps.options) !== null && _a !== void 0 ? _a : [];
2817
+ var optionsConf = (_a = props.options) !== null && _a !== void 0 ? _a : [];
2762
2818
  (function () { return __awaiter(void 0, void 0, void 0, function () {
2763
2819
  var optionsList;
2764
2820
  return __generator(this, function (_a) {
2765
2821
  switch (_a.label) {
2766
2822
  case 0:
2767
2823
  if (!(typeof optionsConf == "function")) return [3 /*break*/, 2];
2768
- return [4 /*yield*/, optionsConf(props.selectedRows)];
2824
+ return [4 /*yield*/, optionsConf(selectedRows)];
2769
2825
  case 1:
2770
2826
  optionsConf = _a.sent();
2771
2827
  _a.label = 2;
@@ -2776,7 +2832,7 @@ var GridFormMultiSelect = function (props) {
2776
2832
  }
2777
2833
  return item;
2778
2834
  });
2779
- if (formProps.filtered) {
2835
+ if (props.filtered) {
2780
2836
  // This is needed otherwise when filter input is rendered and sets autofocus
2781
2837
  // the mouse up of the double click edit triggers the cell to cancel editing
2782
2838
  delay(function () { return setOptions(optionsList); }, 100);
@@ -2789,9 +2845,9 @@ var GridFormMultiSelect = function (props) {
2789
2845
  }
2790
2846
  });
2791
2847
  }); })();
2792
- }, [formProps.filtered, formProps.options, options, props.selectedRows]);
2848
+ }, [props.filtered, props.options, options, selectedRows]);
2793
2849
  useEffect(function () {
2794
- if (!formProps.filtered || options == null)
2850
+ if (!props.filtered || options == null)
2795
2851
  return;
2796
2852
  setFilteredValues(options
2797
2853
  .map(function (option) {
@@ -2803,11 +2859,11 @@ var GridFormMultiSelect = function (props) {
2803
2859
  return str.toLowerCase().indexOf(filter.trim()) === -1 ? option.value : undefined;
2804
2860
  })
2805
2861
  .filter(function (r) { return r !== undefined; }));
2806
- }, [formProps.filtered, filter, options]);
2807
- return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !options }, { children: jsxs("div", __assign({ className: "Grid-popoverContainerList" }, { children: [options && formProps.filtered && (jsxs(Fragment$1, { children: [jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
2862
+ }, [props.filtered, filter, options]);
2863
+ return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !options }, { children: jsxs("div", __assign({ className: "Grid-popoverContainerList" }, { children: [options && props.filtered && (jsxs(Fragment$1, { children: [jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
2808
2864
  var _b;
2809
2865
  var ref = _a.ref;
2810
- return (jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = formProps.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: "", onChange: function (e) { return setFilter(e.target.value.toLowerCase()); } }) })));
2866
+ return (jsx("div", __assign({ style: { display: "flex", width: "100%" } }, { children: jsx("input", { autoFocus: true, className: "free-text-input", style: { border: "0px" }, ref: ref, type: "text", placeholder: (_b = props.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: "", onChange: function (e) { return setFilter(e.target.value.toLowerCase()); } }) })));
2811
2867
  } }), "filter"), jsx(MenuDivider, {}, "$$divider_filter")] })), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
2812
2868
  var _a;
2813
2869
  return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxs(Fragment, { children: [jsx(MenuItem, __assign({ onClick: function (e) {
@@ -2853,11 +2909,8 @@ var GridFormMultiSelect = function (props) {
2853
2909
  })] })) })));
2854
2910
  };
2855
2911
 
2856
- var GridPopoutEditMultiSelect = function (colDef) {
2857
- var _a;
2858
- return GridCell(__assign(__assign({ initialWidth: 65, maxWidth: 150, cellClass: ((_a = colDef.cellEditor) === null || _a === void 0 ? void 0 : _a.multiEdit) ? GenericMultiEditCellClass : undefined }, colDef), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
2859
- cellEditorParams: __assign(__assign({}, colDef.cellEditorParams), { form: GridFormMultiSelect })
2860
- })));
2912
+ var GridPopoutEditMultiSelect = function (colDef, props) {
2913
+ return GridCell(__assign({ initialWidth: 65, maxWidth: 150, cellClass: props.multiEdit ? GenericMultiEditCellClass : undefined }, colDef), __assign({ editor: GridFormMultiSelect }, props));
2861
2914
  };
2862
2915
 
2863
2916
  var css_248z$2 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.GridPopoutMenu-burger {\n cursor: pointer;\n}\n.GridPopoutMenu-burger svg {\n fill: #007198;\n}\n\n.GridPopoutMenu-burgerDisabled svg {\n fill: #989189;\n}";
@@ -2869,8 +2922,8 @@ var PopoutMenuSeparator = Object.freeze({ __isMenuSeparator__: true });
2869
2922
  * NOTE: If the popout menu doesn't appear on single click when also selecting row it's because
2870
2923
  * you need a useMemo around your columnDefs
2871
2924
  */
2872
- var GridFormPopoutMenu = function (props) {
2873
- var formProps = props.formProps;
2925
+ var GridFormPopoutMenu = function (_props) {
2926
+ var props = _props;
2874
2927
  var updatingCells = useContext(GridContext).updatingCells;
2875
2928
  var optionsInitialising = useRef(false);
2876
2929
  var _a = useState(), options = _a[0], setOptions = _a[1];
@@ -2880,7 +2933,7 @@ var GridFormPopoutMenu = function (props) {
2880
2933
  if (options || optionsInitialising.current)
2881
2934
  return;
2882
2935
  optionsInitialising.current = true;
2883
- var optionsConf = (_a = formProps.options) !== null && _a !== void 0 ? _a : [];
2936
+ var optionsConf = (_a = props.options) !== null && _a !== void 0 ? _a : [];
2884
2937
  (function () { return __awaiter(void 0, void 0, void 0, function () {
2885
2938
  var _a;
2886
2939
  return __generator(this, function (_b) {
@@ -2901,7 +2954,7 @@ var GridFormPopoutMenu = function (props) {
2901
2954
  }
2902
2955
  });
2903
2956
  }); })();
2904
- }, [options, formProps.options, props.selectedRows]);
2957
+ }, [options, props.options, props.selectedRows]);
2905
2958
  var actionClick = useCallback(function (menuOption) { return __awaiter(void 0, void 0, void 0, function () {
2906
2959
  return __generator(this, function (_a) {
2907
2960
  switch (_a.label) {
@@ -2929,7 +2982,7 @@ var GridFormPopoutMenu = function (props) {
2929
2982
  var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (menuOption) {
2930
2983
  return menuOption.label === PopoutMenuSeparator || selectedRowCount === 1 || menuOption.supportsMultiEdit;
2931
2984
  });
2932
- var popoverWrapper = useGridPopoverHook(props).popoverWrapper;
2985
+ var popoverWrapper = useGridPopoverHook().popoverWrapper;
2933
2986
  return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: !filteredOptions }, { children: jsx("div", __assign({ className: "Grid-popoverContainerList" }, { children: options === null || options === void 0 ? void 0 : options.map(function (item, index) {
2934
2987
  return item.label === PopoutMenuSeparator ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : (!item.hidden && (jsx(MenuItem, __assign({ onClick: function () { return actionClick(item); }, disabled: !!item.disabled || !(filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.includes(item)), title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "" }, { children: item.label }), "".concat(item.label))));
2935
2988
  }) })) })));
@@ -2938,14 +2991,12 @@ var GridFormPopoutMenu = function (props) {
2938
2991
  /**
2939
2992
  * Popout burger menu
2940
2993
  */
2941
- var GridPopoverMenu = function (colDef) {
2994
+ var GridPopoverMenu = function (colDef, props) {
2942
2995
  var _a;
2943
- return GridCell(__assign(__assign(__assign({ maxWidth: 64, editable: colDef.editable != null ? colDef.editable : true, cellRenderer: GridRenderPopoutMenuCell, cellClass: ((_a = colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) === null || _a === void 0 ? void 0 : _a.multiEdit) !== false ? GenericMultiEditCellClass : undefined }, colDef), { cellRendererParams: {
2996
+ return GridCell(__assign(__assign({ maxWidth: 64, editable: colDef.editable != null ? colDef.editable : true, cellRenderer: GridRenderPopoutMenuCell, cellClass: ((_a = colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) === null || _a === void 0 ? void 0 : _a.multiEdit) !== false ? GenericMultiEditCellClass : undefined }, colDef), { cellRendererParams: {
2944
2997
  // Menus open on single click, this parameter is picked up in Grid.tsx
2945
2998
  singleClickEdit: true
2946
- } }), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
2947
- cellEditorParams: __assign(__assign({ multiEdit: true }, colDef.cellEditorParams), { form: GridFormPopoutMenu })
2948
- })));
2999
+ } }), __assign({ editor: GridFormPopoutMenu }, props));
2949
3000
  };
2950
3001
 
2951
3002
  var bearingValueFormatter = function (params) {
@@ -3036,9 +3087,9 @@ var TextInputFormatted = function (props) {
3036
3087
  return (jsxs("div", __assign({ className: clsx("LuiTextInput Grid-popoverContainer", props.error && "hasError", props.warning && "hasWarning", props.className) }, { children: [jsxs("span", __assign({ className: "LuiTextInput-inputWrapper" }, { children: [jsx("input", __assign({ type: "text", className: "LuiTextInput-input", min: "0", value: props.value, onChange: props.onChange }, props.inputProps)), jsx("span", __assign({ className: "LuiTextInput-formatted" }, { children: props.formatted }))] })), props.error && (jsxs("span", __assign({ className: "LuiTextInput-error" }, { children: [jsx(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextInput-error-icon", size: "sm", status: "error" }), props.error] }))), props.warning && (jsxs("span", __assign({ className: "LuiTextInput-warning" }, { children: [jsx(LuiIcon, { alt: "warning", name: "ic_warning", className: "LuiTextInput-warning-icon", size: "sm", status: "warning" }), props.warning] })))] })));
3037
3088
  };
3038
3089
 
3039
- var GridFormEditBearing = function (props) {
3090
+ var GridFormEditBearing = function (_props) {
3040
3091
  var _a;
3041
- var formProps = props.formProps;
3092
+ var props = _props;
3042
3093
  var _b = useState("".concat((_a = props.value) !== null && _a !== void 0 ? _a : "")), value = _b[0], setValue = _b[1];
3043
3094
  var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
3044
3095
  var parsedValue, field_1;
@@ -3052,8 +3103,8 @@ var GridFormEditBearing = function (props) {
3052
3103
  if (parsedValue === props.value) {
3053
3104
  return [2 /*return*/, true];
3054
3105
  }
3055
- if (!formProps.onSave) return [3 /*break*/, 2];
3056
- return [4 /*yield*/, formProps.onSave(selectedRows, parsedValue)];
3106
+ if (!props.onSave) return [3 /*break*/, 2];
3107
+ return [4 /*yield*/, props.onSave(selectedRows, parsedValue)];
3057
3108
  case 1: return [2 /*return*/, _a.sent()];
3058
3109
  case 2:
3059
3110
  field_1 = props.field;
@@ -3067,42 +3118,42 @@ var GridFormEditBearing = function (props) {
3067
3118
  case 3: return [2 /*return*/, true];
3068
3119
  }
3069
3120
  });
3070
- }); }, [formProps, props.field, props.value, value]);
3071
- var _c = useGridPopoverHook(props, save), popoverWrapper = _c.popoverWrapper, triggerSave = _c.triggerSave;
3121
+ }); }, [props, value]);
3122
+ var _c = useGridPopoverHook({ save: save }), triggerSave = _c.triggerSave, popoverWrapper = _c.popoverWrapper;
3072
3123
  return popoverWrapper(jsx("div", __assign({ className: "GridFormEditBearing-input Grid-popoverContainer" }, { children: jsx(TextInputFormatted, { value: value !== null && value !== void 0 ? value : "", onChange: function (e) {
3073
3124
  setValue(e.target.value.trim());
3074
3125
  }, inputProps: {
3075
3126
  autoFocus: true,
3076
- placeholder: formProps.placeHolder,
3127
+ placeholder: props.placeHolder,
3077
3128
  disabled: false,
3078
3129
  maxLength: 16,
3079
3130
  onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
3080
3131
  return [2 /*return*/, e.key === "Enter" && triggerSave().then()];
3081
3132
  }); }); }
3082
- }, formatted: bearingStringValidator(value, formProps.range) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, formProps.range) }) })));
3133
+ }, formatted: bearingStringValidator(value, props.range) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, props.range) }) })));
3083
3134
  };
3084
3135
 
3085
- var GridPopoverEditBearingLike = function (colDef) {
3086
- var _a;
3087
- return GridCell(__assign(__assign({ initialWidth: 65, maxWidth: 150, valueFormatter: bearingValueFormatter, cellClass: ((_a = colDef.cellEditorParams) === null || _a === void 0 ? void 0 : _a.multiEdit) ? GenericMultiEditCellClass : undefined }, colDef), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
3088
- cellEditorParams: __assign(__assign({}, colDef.cellEditorParams), { form: GridFormEditBearing })
3089
- })));
3136
+ var GridPopoverEditBearingLike = function (colDef, props) {
3137
+ return GridCell(__assign({ initialWidth: 65, maxWidth: 150, valueFormatter: bearingValueFormatter, cellClass: props.multiEdit ? GenericMultiEditCellClass : undefined }, colDef), __assign({ editor: GridFormEditBearing }, props));
3090
3138
  };
3091
- var GridPopoverEditBearing = function (colDef) {
3092
- var init = GridPopoverEditBearingLike(colDef);
3093
- return __assign(__assign({}, init), { valueFormatter: bearingValueFormatter, cellEditorParams: __assign({ range: function (value) {
3139
+ var GridPopoverEditBearing = function (colDef, props) {
3140
+ return GridPopoverEditBearingLike(__assign({ valueFormatter: bearingValueFormatter }, colDef), {
3141
+ multiEdit: !!props.multiEdit,
3142
+ editorParams: __assign({ placeHolder: "Enter bearing correction", range: function (value) {
3094
3143
  if (value === null)
3095
- return "Bearing is required";
3144
+ return "Bearing correction is required";
3096
3145
  if (value >= 360)
3097
- return "Bearing must be less than 360 degrees";
3146
+ return "Bearing correction must be less than 360 degrees";
3098
3147
  if (value < 0)
3099
- return "Bearing must not be negative";
3148
+ return "Bearing correction must not be negative";
3100
3149
  return null;
3101
- } }, init.cellEditorParams) });
3150
+ } }, props.editorParams)
3151
+ });
3102
3152
  };
3103
- var GridPopoverEditBearingCorrection = function (colDef) {
3104
- var init = GridPopoverEditBearingLike(colDef);
3105
- return __assign(__assign({}, init), { valueFormatter: bearingCorrectionValueFormatter, cellEditorParams: __assign({ range: function (value) {
3153
+ var GridPopoverEditBearingCorrection = function (colDef, props) {
3154
+ return GridPopoverEditBearingLike(__assign({ valueFormatter: bearingCorrectionValueFormatter }, colDef), {
3155
+ multiEdit: !!props.multiEdit,
3156
+ editorParams: __assign({ placeHolder: "Enter bearing correction", range: function (value) {
3106
3157
  if (value === null)
3107
3158
  return "Bearing is required";
3108
3159
  if (value >= 360)
@@ -3110,20 +3161,18 @@ var GridPopoverEditBearingCorrection = function (colDef) {
3110
3161
  if (value <= -180)
3111
3162
  return "Bearing must be greater then -180 degrees";
3112
3163
  return null;
3113
- } }, init.cellEditorParams) });
3164
+ } }, props.editorParams)
3165
+ });
3114
3166
  };
3115
3167
 
3116
- var GridPopoverEditDropDown = function (colDef) {
3117
- var _a;
3118
- return GridCell(__assign(__assign({ initialWidth: 65, maxWidth: 150, cellClass: ((_a = colDef.cellEditor) === null || _a === void 0 ? void 0 : _a.multiEdit) ? GenericMultiEditCellClass : undefined }, colDef), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
3119
- cellEditorParams: __assign(__assign({}, colDef.cellEditorParams), { form: GridFormDropDown })
3120
- })));
3168
+ var GridPopoverEditDropDown = function (colDef, props) {
3169
+ return GridCell(__assign({ initialWidth: 65, maxWidth: 150, cellClass: props.multiEdit ? GenericMultiEditCellClass : undefined }, colDef), __assign({ editor: GridFormDropDown }, props));
3121
3170
  };
3122
3171
 
3123
- var GridFormMessage = function (props) {
3124
- var formProps = props.formProps;
3172
+ var GridFormMessage = function (_props) {
3173
+ var props = _props;
3125
3174
  var _a = useState(null), message = _a[0], setMessage = _a[1];
3126
- var popoverWrapper = useGridPopoverHook(props).popoverWrapper;
3175
+ var popoverWrapper = useGridPopoverHook().popoverWrapper;
3127
3176
  useEffect(function () {
3128
3177
  (function () { return __awaiter(void 0, void 0, void 0, function () {
3129
3178
  var _a;
@@ -3131,24 +3180,19 @@ var GridFormMessage = function (props) {
3131
3180
  switch (_b.label) {
3132
3181
  case 0:
3133
3182
  _a = setMessage;
3134
- return [4 /*yield*/, formProps.message(props.selectedRows, props.cellEditorParams)];
3183
+ return [4 /*yield*/, props.message(props)];
3135
3184
  case 1:
3136
3185
  _a.apply(void 0, [_b.sent()]);
3137
3186
  return [2 /*return*/];
3138
3187
  }
3139
3188
  });
3140
3189
  }); })().then();
3141
- }, [formProps, props.selectedRows, props]);
3190
+ }, [props]);
3142
3191
  return popoverWrapper(jsx(ComponentLoadingWrapper, __assign({ loading: message === null }, { children: jsx("div", __assign({ style: { maxWidth: 400 }, className: "Grid-popoverContainer" }, { children: message })) })));
3143
3192
  };
3144
3193
 
3145
- var GridPopoverMessage = function (colDef) {
3146
- var _a;
3147
- return GridCell(__assign(__assign(__assign({ maxWidth: 140 }, colDef), { cellRendererParams: (_a = colDef.cellRendererParams) !== null && _a !== void 0 ? _a : {
3148
- singleClickEdit: true
3149
- } }), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
3150
- cellEditorParams: __assign(__assign({}, colDef.cellEditorParams), { form: GridFormMessage })
3151
- })));
3194
+ var GridPopoverMessage = function (colDef, props) {
3195
+ return GridCell(__assign(__assign({ maxWidth: 140 }, colDef), { cellRendererParams: __assign({ singleClickEdit: true }, colDef.cellRendererParams) }), __assign({ editor: GridFormMessage }, props));
3152
3196
  };
3153
3197
 
3154
3198
  var useGenerateOrDefaultId = function (idFromProps) {
@@ -3161,22 +3205,22 @@ var TextAreaInput = function (props) {
3161
3205
  return (jsxs("div", __assign({ className: clsx("LuiTextAreaInput Grid-popoverContainer", ((_b = props.inputProps) === null || _b === void 0 ? void 0 : _b.disabled) ? "isDisabled" : "", (props === null || props === void 0 ? void 0 : props.error) ? "hasError" : "") }, { children: [jsxs("label", __assign({ htmlFor: id }, { children: [props.mandatory && jsx("span", __assign({ className: "LuiTextAreaInput-mandatory" }, { children: "*" })), props.label && jsx("span", __assign({ className: "LuiTextAreaInput-label" }, { children: props.label })), jsxs("div", __assign({ className: "LuiTextAreaInput-wrapper" }, { children: [" ", jsx("textarea", __assign({ id: id, value: props.value, onChange: props.onChange, rows: 5 }, props.inputProps))] }))] })), props.error && (jsxs("span", __assign({ className: "LuiTextAreaInput-error" }, { children: [jsx(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextAreaInput-error-icon", size: "sm", status: "error" }), props.error] })))] })));
3162
3206
  };
3163
3207
 
3164
- var GridFormTextArea = function (props) {
3208
+ var GridFormTextArea = function (_props) {
3165
3209
  var _a, _b;
3166
- var formProps = props.formProps;
3210
+ var props = _props;
3167
3211
  var _c = useState((_a = props.value) !== null && _a !== void 0 ? _a : ""), value = _c[0], setValue = _c[1];
3168
3212
  var invalid = useCallback(function () {
3169
- if (formProps.required && value.length == 0) {
3213
+ if (props.required && value.length == 0) {
3170
3214
  return "Some text is required";
3171
3215
  }
3172
- if (formProps.maxlength && value.length > formProps.maxlength) {
3173
- return "Text must be no longer than ".concat(formProps.maxlength, " characters");
3216
+ if (props.maxlength && value.length > props.maxlength) {
3217
+ return "Text must be no longer than ".concat(props.maxlength, " characters");
3174
3218
  }
3175
- if (formProps.validate) {
3176
- return formProps.validate(value);
3219
+ if (props.validate) {
3220
+ return props.validate(value);
3177
3221
  }
3178
3222
  return null;
3179
- }, [formProps, value]);
3223
+ }, [props, value]);
3180
3224
  var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
3181
3225
  var field;
3182
3226
  return __generator(this, function (_a) {
@@ -3186,8 +3230,8 @@ var GridFormTextArea = function (props) {
3186
3230
  return [2 /*return*/, false];
3187
3231
  if (props.value === (value !== null && value !== void 0 ? value : ""))
3188
3232
  return [2 /*return*/, true];
3189
- if (!formProps.onSave) return [3 /*break*/, 2];
3190
- return [4 /*yield*/, formProps.onSave(selectedRows, value)];
3233
+ if (!props.onSave) return [3 /*break*/, 2];
3234
+ return [4 /*yield*/, props.onSave(selectedRows, value)];
3191
3235
  case 1: return [2 /*return*/, _a.sent()];
3192
3236
  case 2:
3193
3237
  field = props.field;
@@ -3199,35 +3243,33 @@ var GridFormTextArea = function (props) {
3199
3243
  return [2 /*return*/, true];
3200
3244
  }
3201
3245
  });
3202
- }); }, [formProps, invalid, props.field, props.value, value]);
3203
- var popoverWrapper = useGridPopoverHook(props, save).popoverWrapper;
3204
- return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (_b = formProps.width) !== null && _b !== void 0 ? _b : 240 }, className: "FormTest" }, { children: jsx(TextAreaInput, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), inputProps: { placeholder: formProps.placeholder } }) })));
3246
+ }); }, [props, invalid, value]);
3247
+ var popoverWrapper = useGridPopoverHook({ save: save }).popoverWrapper;
3248
+ return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (_b = props.width) !== null && _b !== void 0 ? _b : 240 }, className: "FormTest" }, { children: jsx(TextAreaInput, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), inputProps: { placeholder: props.placeholder } }) })));
3205
3249
  };
3206
3250
 
3207
- var GridPopoverTextArea = function (colDef) {
3208
- return GridCell(__assign(__assign({ maxWidth: 260 }, colDef), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
3209
- cellEditorParams: __assign(__assign({ width: 260 }, colDef.cellEditorParams), { form: GridFormTextArea })
3210
- })));
3251
+ var GridPopoverTextArea = function (colDef, params) {
3252
+ return GridCell(__assign({ maxWidth: 260 }, colDef), __assign({ editor: GridFormTextArea }, params));
3211
3253
  };
3212
3254
 
3213
- var GridFormTextInput = function (props) {
3255
+ var GridFormTextInput = function (_props) {
3214
3256
  var _a;
3215
- var formProps = props.formProps;
3257
+ var props = _props;
3216
3258
  var initValue = props.value == null ? "" : "".concat(props.value);
3217
3259
  var _b = useState(initValue), value = _b[0], setValue = _b[1];
3218
3260
  var invalid = useCallback(function () {
3219
3261
  var trimmedValue = value.trim();
3220
- if (formProps.required && trimmedValue.length == 0) {
3262
+ if (props.required && trimmedValue.length == 0) {
3221
3263
  return "Some text is required";
3222
3264
  }
3223
- if (formProps.maxlength && trimmedValue.length > formProps.maxlength) {
3224
- return "Text must be no longer than ".concat(formProps.maxlength, " characters");
3265
+ if (props.maxlength && trimmedValue.length > props.maxlength) {
3266
+ return "Text must be no longer than ".concat(props.maxlength, " characters");
3225
3267
  }
3226
- if (formProps.validate) {
3227
- return formProps.validate(trimmedValue, props.data);
3268
+ if (props.validate) {
3269
+ return props.validate(trimmedValue, props.data);
3228
3270
  }
3229
3271
  return null;
3230
- }, [formProps, value]);
3272
+ }, [props, value]);
3231
3273
  var save = useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
3232
3274
  var trimmedValue, field;
3233
3275
  return __generator(this, function (_a) {
@@ -3238,8 +3280,8 @@ var GridFormTextInput = function (props) {
3238
3280
  trimmedValue = value.trim();
3239
3281
  if (initValue === trimmedValue)
3240
3282
  return [2 /*return*/, true];
3241
- if (!formProps.onSave) return [3 /*break*/, 2];
3242
- return [4 /*yield*/, formProps.onSave(selectedRows, trimmedValue)];
3283
+ if (!props.onSave) return [3 /*break*/, 2];
3284
+ return [4 /*yield*/, props.onSave(selectedRows, trimmedValue)];
3243
3285
  case 1: return [2 /*return*/, _a.sent()];
3244
3286
  case 2:
3245
3287
  field = props.field;
@@ -3251,21 +3293,19 @@ var GridFormTextInput = function (props) {
3251
3293
  return [2 /*return*/, true];
3252
3294
  }
3253
3295
  });
3254
- }); }, [invalid, value, initValue, formProps, props.field]);
3255
- var _c = useGridPopoverHook(props, save), popoverWrapper = _c.popoverWrapper, triggerSave = _c.triggerSave;
3256
- return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (_a = formProps.width) !== null && _a !== void 0 ? _a : 240 }, className: "FormTest" }, { children: jsx(TextInputFormatted, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), formatted: formProps.units, inputProps: {
3296
+ }); }, [invalid, value, initValue, props]);
3297
+ var _c = useGridPopoverHook({ save: save }), popoverWrapper = _c.popoverWrapper, triggerSave = _c.triggerSave;
3298
+ return popoverWrapper(jsx("div", __assign({ style: { display: "flex", flexDirection: "row", width: (_a = props.width) !== null && _a !== void 0 ? _a : 240 }, className: "FormTest" }, { children: jsx(TextInputFormatted, { value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), formatted: props.units, inputProps: {
3257
3299
  style: { width: "100%" },
3258
- placeholder: formProps.placeholder,
3300
+ placeholder: props.placeholder,
3259
3301
  onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
3260
3302
  return [2 /*return*/, e.key === "Enter" && triggerSave().then()];
3261
3303
  }); }); }
3262
3304
  } }) })));
3263
3305
  };
3264
3306
 
3265
- var GridPopoverTextInput = function (colDef) {
3266
- return GridCell(__assign(__assign({ maxWidth: 140 }, colDef), ((colDef === null || colDef === void 0 ? void 0 : colDef.cellEditorParams) && {
3267
- cellEditorParams: __assign(__assign({ width: 240 }, colDef.cellEditorParams), { form: GridFormTextInput })
3268
- })));
3307
+ var GridPopoverTextInput = function (colDef, params) {
3308
+ return GridCell(__assign({ maxWidth: 140 }, colDef), __assign({ editor: GridFormTextInput }, params));
3269
3309
  };
3270
3310
 
3271
3311
  var GridSubComponentTextArea = function (props) {
@@ -3276,5 +3316,5 @@ var GridSubComponentTextArea = function (props) {
3276
3316
  return (jsx("div", __assign({ className: "FreeTextInput LuiDeprecatedForms" }, { children: jsx("textarea", { autoFocus: true, maxLength: 10000, spellCheck: true, className: "free-text-input", onChange: function (e) { return setValue(e.target.value); }, defaultValue: value }) })));
3277
3317
  };
3278
3318
 
3279
- export { ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponent, GenericCellEditorComponentFr, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoutMenu, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentTextArea, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, UpdatingContext, UpdatingContextProvider, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, convertDDToDMS, hasParentClass, isFloat, isNotEmpty, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
3319
+ export { ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponent, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoutMenu, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentTextArea, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, convertDDToDMS, hasParentClass, isFloat, isNotEmpty, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
3280
3320
  //# sourceMappingURL=step-ag-grid.esm.js.map