@linzjs/step-ag-grid 1.5.0 → 1.5.2

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.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export * from "./src/react-menu3/index";
2
2
  export * from "./src/react-menu3/types";
3
- export { UpdatingContext } from "./src/contexts/UpdatingContext";
4
- export { UpdatingContextProvider } from "./src/contexts/UpdatingContextProvider";
5
- export { GridContext } from "./src/contexts/GridContext";
6
- export { GridContextProvider } from "./src/contexts/GridContextProvider";
3
+ export * from "./src/contexts/UpdatingContext";
4
+ export * from "./src/contexts/UpdatingContextProvider";
5
+ export * from "./src/contexts/GridContext";
6
+ export * from "./src/contexts/GridContextProvider";
7
7
  export type { GridBaseRow } from "./src/components/Grid";
8
8
  export { Grid } from "./src/components/Grid";
9
9
  export { GridCell } from "./src/components/GridCell";
package/dist/index.js CHANGED
@@ -802,14 +802,15 @@ var positionMenu = function (props) {
802
802
  };
803
803
 
804
804
  var MenuList = function (_a) {
805
- var ariaLabel = _a.ariaLabel, menuClassName = _a.menuClassName, menuStyle = _a.menuStyle, arrowClassName = _a.arrowClassName, arrowStyle = _a.arrowStyle, anchorPoint = _a.anchorPoint, anchorRef = _a.anchorRef, containerRef = _a.containerRef, externalRef = _a.externalRef, parentScrollingRef = _a.parentScrollingRef, arrow = _a.arrow, _b = _a.align, align = _b === void 0 ? "start" : _b, _c = _a.direction, direction = _c === void 0 ? "bottom" : _c, _d = _a.position, position = _d === void 0 ? "auto" : _d, _e = _a.overflow, overflow = _e === void 0 ? "visible" : _e, setDownOverflow = _a.setDownOverflow, repositionFlag = _a.repositionFlag, _f = _a.captureFocus, captureFocus = _f === void 0 ? true : _f, state = _a.state, endTransition = _a.endTransition, isDisabled = _a.isDisabled, menuItemFocus = _a.menuItemFocus, _g = _a.offsetX, offsetX = _g === void 0 ? 0 : _g, _h = _a.offsetY, offsetY = _h === void 0 ? 0 : _h, children = _a.children, onClose = _a.onClose, restProps = __rest(_a, ["ariaLabel", "menuClassName", "menuStyle", "arrowClassName", "arrowStyle", "anchorPoint", "anchorRef", "containerRef", "externalRef", "parentScrollingRef", "arrow", "align", "direction", "position", "overflow", "setDownOverflow", "repositionFlag", "captureFocus", "state", "endTransition", "isDisabled", "menuItemFocus", "offsetX", "offsetY", "children", "onClose"]);
806
- var _j = react.useState({ x: 0, y: 0 }), menuPosition = _j[0], setMenuPosition = _j[1];
807
- var _k = react.useState({ x: 0, y: 0 }), arrowPosition = _k[0], setArrowPosition = _k[1];
808
- var _l = react.useState(), overflowData = _l[0], setOverflowData = _l[1];
809
- var _m = react.useState(direction), expandedDirection = _m[0], setExpandedDirection = _m[1];
810
- var _o = react.useState(0), openSubmenuCount = _o[0], setOpenSubmenuCount = _o[1];
811
- var _p = react.useReducer(function (c) { return c + 1; }, 1), reposSubmenu = _p[0], forceReposSubmenu = _p[1];
812
- var _q = react.useContext(SettingsContext), transition = _q.transition, boundingBoxRef = _q.boundingBoxRef, boundingBoxPadding = _q.boundingBoxPadding, rootMenuRef = _q.rootMenuRef, rootAnchorRef = _q.rootAnchorRef, scrollNodesRef = _q.scrollNodesRef, reposition = _q.reposition, viewScroll = _q.viewScroll;
805
+ var _b, _c;
806
+ var ariaLabel = _a.ariaLabel, menuClassName = _a.menuClassName, menuStyle = _a.menuStyle, arrowClassName = _a.arrowClassName, arrowStyle = _a.arrowStyle, anchorPoint = _a.anchorPoint, anchorRef = _a.anchorRef, containerRef = _a.containerRef, externalRef = _a.externalRef, parentScrollingRef = _a.parentScrollingRef, arrow = _a.arrow, _d = _a.align, align = _d === void 0 ? "start" : _d, _e = _a.direction, direction = _e === void 0 ? "bottom" : _e, _f = _a.position, position = _f === void 0 ? "auto" : _f, _g = _a.overflow, overflow = _g === void 0 ? "visible" : _g, setDownOverflow = _a.setDownOverflow, repositionFlag = _a.repositionFlag, _h = _a.captureFocus, captureFocus = _h === void 0 ? true : _h, state = _a.state, endTransition = _a.endTransition, isDisabled = _a.isDisabled, menuItemFocus = _a.menuItemFocus, dontShrinkIfDirectionIsTop = _a.dontShrinkIfDirectionIsTop, _j = _a.offsetX, offsetX = _j === void 0 ? 0 : _j, _k = _a.offsetY, offsetY = _k === void 0 ? 0 : _k, children = _a.children, onClose = _a.onClose, restProps = __rest(_a, ["ariaLabel", "menuClassName", "menuStyle", "arrowClassName", "arrowStyle", "anchorPoint", "anchorRef", "containerRef", "externalRef", "parentScrollingRef", "arrow", "align", "direction", "position", "overflow", "setDownOverflow", "repositionFlag", "captureFocus", "state", "endTransition", "isDisabled", "menuItemFocus", "dontShrinkIfDirectionIsTop", "offsetX", "offsetY", "children", "onClose"]);
807
+ var _l = react.useState({ x: 0, y: 0 }), menuPosition = _l[0], setMenuPosition = _l[1];
808
+ var _m = react.useState({ x: 0, y: 0 }), arrowPosition = _m[0], setArrowPosition = _m[1];
809
+ var _o = react.useState(), overflowData = _o[0], setOverflowData = _o[1];
810
+ var _p = react.useState(direction), expandedDirection = _p[0], setExpandedDirection = _p[1];
811
+ var _q = react.useState(0), openSubmenuCount = _q[0], setOpenSubmenuCount = _q[1];
812
+ var _r = react.useReducer(function (c) { return c + 1; }, 1), reposSubmenu = _r[0], forceReposSubmenu = _r[1];
813
+ var _s = react.useContext(SettingsContext), transition = _s.transition, boundingBoxRef = _s.boundingBoxRef, boundingBoxPadding = _s.boundingBoxPadding, rootMenuRef = _s.rootMenuRef, rootAnchorRef = _s.rootAnchorRef, scrollNodesRef = _s.scrollNodesRef, reposition = _s.reposition, viewScroll = _s.viewScroll;
813
814
  var reposFlag = react.useContext(MenuListContext).reposSubmenu || repositionFlag;
814
815
  var menuRef = react.useRef({});
815
816
  var focusRef = react.useRef(null);
@@ -817,7 +818,7 @@ var MenuList = function (_a) {
817
818
  var prevOpen = react.useRef(false);
818
819
  var latestMenuSize = react.useRef({ width: 0, height: 0 });
819
820
  var latestHandlePosition = react.useRef(function () { });
820
- var _r = useItems(menuRef, focusRef), hoverItem = _r.hoverItem, dispatch = _r.dispatch, updateItems = _r.updateItems;
821
+ var _t = useItems(menuRef, focusRef), hoverItem = _t.hoverItem, dispatch = _t.dispatch, updateItems = _t.updateItems;
821
822
  var isOpen = isMenuOpen(state);
822
823
  var openTransition = getTransition(transition, "open");
823
824
  var closeTransition = getTransition(transition, "close");
@@ -1125,7 +1126,21 @@ var MenuList = function (_a) {
1125
1126
  modifiers: arrowModifiers,
1126
1127
  className: arrowClassName
1127
1128
  });
1128
- return (jsxRuntime.jsxs("ul", __assign({ role: "menu", "aria-label": ariaLabel }, mergeProps({ onKeyDown: onKeyDown, onAnimationEnd: onAnimationEnd }, restProps), commonProps(isDisabled), { ref: useCombinedRef(externalRef, menuRef), className: useBEM({ block: menuClass, modifiers: modifiers, className: menuClassName }), style: __assign(__assign(__assign({}, menuStyle), overflowStyle), { margin: 0, display: state === "closed" ? "none" : undefined, position: "absolute", left: menuPosition.x, top: menuPosition.y }) }, { children: [jsxRuntime.jsx("div", { ref: focusRef, tabIndex: -1, style: { position: "absolute", left: 0, top: 0 } }), arrow && (jsxRuntime.jsx("div", { className: _arrowClass, style: __assign(__assign({}, arrowStyle), { position: "absolute", left: arrowPosition.x, top: arrowPosition.y }), ref: arrowRef })), jsxRuntime.jsx(MenuListContext.Provider, __assign({ value: listContext }, { children: jsxRuntime.jsx(MenuListItemContext.Provider, __assign({ value: itemContext }, { children: jsxRuntime.jsx(HoverItemContext.Provider, __assign({ value: hoverItem }, { children: children })) })) }))] })));
1129
+ var minHeight = react.useRef(0);
1130
+ if (dontShrinkIfDirectionIsTop && ((_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect)) {
1131
+ var h = (_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().height;
1132
+ if (minHeight.current < h)
1133
+ minHeight.current = h;
1134
+ }
1135
+ var dontShrinkOps = react.useMemo(function () {
1136
+ return expandedDirection === "top" && dontShrinkIfDirectionIsTop
1137
+ ? {
1138
+ overflowY: isSubmenuOpen ? "" : "auto",
1139
+ minHeight: (isSubmenuOpen ? 0 : minHeight.current) + "px"
1140
+ }
1141
+ : undefined;
1142
+ }, [dontShrinkIfDirectionIsTop, expandedDirection, isSubmenuOpen]);
1143
+ return (jsxRuntime.jsxs("ul", __assign({ role: "menu", "aria-label": ariaLabel }, mergeProps({ onKeyDown: onKeyDown, onAnimationEnd: onAnimationEnd }, restProps), commonProps(isDisabled), { ref: useCombinedRef(externalRef, menuRef), className: useBEM({ block: menuClass, modifiers: modifiers, className: menuClassName }), style: __assign(__assign(__assign(__assign({}, menuStyle), overflowStyle), dontShrinkOps), { margin: 0, display: state === "closed" ? "none" : undefined, position: "absolute", left: menuPosition.x, top: menuPosition.y }) }, { children: [jsxRuntime.jsx("div", { ref: focusRef, tabIndex: -1, style: { position: "absolute", left: 0, top: 0 } }), arrow && (jsxRuntime.jsx("div", { className: _arrowClass, style: __assign(__assign({}, arrowStyle), { position: "absolute", left: arrowPosition.x, top: arrowPosition.y }), ref: arrowRef })), jsxRuntime.jsx(MenuListContext.Provider, __assign({ value: listContext }, { children: jsxRuntime.jsx(MenuListItemContext.Provider, __assign({ value: itemContext }, { children: jsxRuntime.jsx(HoverItemContext.Provider, __assign({ value: hoverItem }, { children: children })) })) }))] })));
1129
1144
  };
1130
1145
 
1131
1146
  // Typed version of lodash !isEmpty
@@ -2502,7 +2517,7 @@ var useGridPopoverHook = function (props, save) {
2502
2517
  });
2503
2518
  }); }, [save, stopEditing, updateValue]);
2504
2519
  var popoverWrapper = react.useCallback(function (children) {
2505
- 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: "lui-menu", onClose: function (event) { return triggerSave(event.reason).then(); } }, { children: [saving && (jsxRuntime.jsx("div", { style: {
2520
+ 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: "lui-menu", onClose: function (event) { return triggerSave(event.reason).then(); }, reposition: "initial", viewScroll: "auto", dontShrinkIfDirectionIsTop: true }, { children: [saving && (jsxRuntime.jsx("div", { style: {
2506
2521
  position: "absolute",
2507
2522
  left: 0,
2508
2523
  top: 0,
@@ -2549,19 +2564,17 @@ var GridFormMultiSelect = function (props) {
2549
2564
  var optionsInitialising = react.useRef(false);
2550
2565
  var _c = react.useState(), options = _c[0], setOptions = _c[1];
2551
2566
  var subSelectedValues = react.useRef({});
2552
- var _d = react.useState([]), selectedValues = _d[0], setSelectedValues = _d[1];
2567
+ var _d = react.useState(function () {
2568
+ return formProps.initialSelectedValues ? formProps.initialSelectedValues(props.selectedRows) : [];
2569
+ }), selectedValues = _d[0], setSelectedValues = _d[1];
2553
2570
  var save = react.useCallback(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
2554
2571
  var values;
2555
2572
  return __generator(this, function (_a) {
2556
2573
  switch (_a.label) {
2557
2574
  case 0:
2558
- values = {};
2559
- selectedValues.forEach(function (value) {
2560
- var _a;
2561
- values[value] = (_a = subSelectedValues.current[value]) !== null && _a !== void 0 ? _a : true;
2562
- });
2575
+ values = lodashEs.fromPairs(selectedValues.map(function (value) { var _a; return [value, (_a = subSelectedValues.current[value]) !== null && _a !== void 0 ? _a : true]; }));
2563
2576
  if (!formProps.onSave) return [3 /*break*/, 2];
2564
- return [4 /*yield*/, formProps.onSave({ selectedRows: selectedRows, values: selectedValues })];
2577
+ return [4 /*yield*/, formProps.onSave({ selectedRows: selectedRows, values: values })];
2565
2578
  case 1: return [2 /*return*/, _a.sent()];
2566
2579
  case 2: return [2 /*return*/, true];
2567
2580
  }
@@ -2895,7 +2908,7 @@ var GridFormEditBearing = function (props) {
2895
2908
  onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
2896
2909
  return [2 /*return*/, e.key === "Enter" && triggerSave().then()];
2897
2910
  }); }); }
2898
- }, formatted: bearingStringValidator(value) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, formProps.range) }) })));
2911
+ }, formatted: bearingStringValidator(value, formProps.range) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, formProps.range) }) })));
2899
2912
  };
2900
2913
 
2901
2914
  var GridPopoverEditBearingLike = function (colDef) {
@@ -2904,24 +2917,30 @@ var GridPopoverEditBearingLike = function (colDef) {
2904
2917
  cellEditorParams: __assign(__assign({}, colDef.cellEditorParams), { form: GridFormEditBearing })
2905
2918
  })));
2906
2919
  };
2907
- var GridPopoverEditBearing = function (colDef) { return (__assign(__assign({}, GridPopoverEditBearingLike(colDef)), { valueFormatter: bearingValueFormatter, range: function (value) {
2908
- if (value === null)
2909
- return "Bearing is required";
2910
- if (value >= 360)
2911
- return "Bearing must be less than 360 degrees";
2912
- if (value < 0)
2913
- return "Bearing must not be negative";
2914
- return null;
2915
- } })); };
2916
- var GridPopoverEditBearingCorrection = function (colDef) { return (__assign(__assign({}, GridPopoverEditBearingLike(colDef)), { valueFormatter: bearingCorrectionValueFormatter, range: function (value) {
2917
- if (value === null)
2918
- return "Bearing is required";
2919
- if (value >= 360)
2920
- return "Bearing must be less than 360 degrees";
2921
- if (value <= -180)
2922
- return "Bearing must be greater then -180 degrees";
2923
- return null;
2924
- } })); };
2920
+ var GridPopoverEditBearing = function (colDef) {
2921
+ var init = GridPopoverEditBearingLike(colDef);
2922
+ return __assign(__assign({}, init), { valueFormatter: bearingValueFormatter, cellEditorParams: __assign({ range: function (value) {
2923
+ if (value === null)
2924
+ return "Bearing is required";
2925
+ if (value >= 360)
2926
+ return "Bearing must be less than 360 degrees";
2927
+ if (value < 0)
2928
+ return "Bearing must not be negative";
2929
+ return null;
2930
+ } }, init.cellEditorParams) });
2931
+ };
2932
+ var GridPopoverEditBearingCorrection = function (colDef) {
2933
+ var init = GridPopoverEditBearingLike(colDef);
2934
+ return __assign(__assign({}, init), { valueFormatter: bearingCorrectionValueFormatter, cellEditorParams: __assign({ range: function (value) {
2935
+ if (value === null)
2936
+ return "Bearing is required";
2937
+ if (value >= 360)
2938
+ return "Bearing must be less than 360 degrees";
2939
+ if (value <= -180)
2940
+ return "Bearing must be greater then -180 degrees";
2941
+ return null;
2942
+ } }, init.cellEditorParams) });
2943
+ };
2925
2944
 
2926
2945
  var MenuSeparatorString = "_____MENU_SEPARATOR_____";
2927
2946
  Object.freeze({ value: MenuSeparatorString });