@linzjs/step-ag-grid 1.4.10 → 1.5.1
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 +4 -4
- package/dist/index.js +86 -35
- package/dist/index.js.map +1 -1
- package/dist/src/components/GridCell.d.ts +1 -0
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -0
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +2 -4
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +1 -1
- package/dist/src/react-menu3/components/Menu.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -1
- package/dist/src/react-menu3/types.d.ts +4 -0
- package/dist/step-ag-grid.esm.js +86 -35
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridCell.tsx +1 -0
- package/src/components/GridPopoverHook.tsx +3 -0
- package/src/components/gridForm/GridFormDropDown.tsx +18 -1
- package/src/components/gridForm/GridFormEditBearing.tsx +1 -1
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +32 -20
- package/src/react-menu3/components/MenuList.tsx +19 -0
- package/src/react-menu3/types.ts +4 -0
- package/src/stories/components/GridPopoutBearing.stories.tsx +1 -1
- package/src/stories/components/GridPopoutEditDropDown.stories.tsx +24 -0
- package/src/utils/bearing.ts +0 -1
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
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
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
|
|
806
|
-
var
|
|
807
|
-
var
|
|
808
|
-
var
|
|
809
|
-
var
|
|
810
|
-
var
|
|
811
|
-
var
|
|
812
|
-
var
|
|
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
|
|
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
|
-
|
|
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,
|
|
@@ -2895,7 +2910,7 @@ var GridFormEditBearing = function (props) {
|
|
|
2895
2910
|
onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
2896
2911
|
return [2 /*return*/, e.key === "Enter" && triggerSave().then()];
|
|
2897
2912
|
}); }); }
|
|
2898
|
-
}, formatted: bearingStringValidator(value) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, formProps.range) }) })));
|
|
2913
|
+
}, formatted: bearingStringValidator(value, formProps.range) ? "?" : convertDDToDMS(bearingNumberParser(value)), error: bearingStringValidator(value, formProps.range) }) })));
|
|
2899
2914
|
};
|
|
2900
2915
|
|
|
2901
2916
|
var GridPopoverEditBearingLike = function (colDef) {
|
|
@@ -2904,24 +2919,30 @@ var GridPopoverEditBearingLike = function (colDef) {
|
|
|
2904
2919
|
cellEditorParams: __assign(__assign({}, colDef.cellEditorParams), { form: GridFormEditBearing })
|
|
2905
2920
|
})));
|
|
2906
2921
|
};
|
|
2907
|
-
var GridPopoverEditBearing = function (colDef) {
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2922
|
+
var GridPopoverEditBearing = function (colDef) {
|
|
2923
|
+
var init = GridPopoverEditBearingLike(colDef);
|
|
2924
|
+
return __assign(__assign({}, init), { valueFormatter: bearingValueFormatter, cellEditorParams: __assign({ range: function (value) {
|
|
2925
|
+
if (value === null)
|
|
2926
|
+
return "Bearing is required";
|
|
2927
|
+
if (value >= 360)
|
|
2928
|
+
return "Bearing must be less than 360 degrees";
|
|
2929
|
+
if (value < 0)
|
|
2930
|
+
return "Bearing must not be negative";
|
|
2931
|
+
return null;
|
|
2932
|
+
} }, init.cellEditorParams) });
|
|
2933
|
+
};
|
|
2934
|
+
var GridPopoverEditBearingCorrection = function (colDef) {
|
|
2935
|
+
var init = GridPopoverEditBearingLike(colDef);
|
|
2936
|
+
return __assign(__assign({}, init), { valueFormatter: bearingCorrectionValueFormatter, cellEditorParams: __assign({ range: function (value) {
|
|
2937
|
+
if (value === null)
|
|
2938
|
+
return "Bearing is required";
|
|
2939
|
+
if (value >= 360)
|
|
2940
|
+
return "Bearing must be less than 360 degrees";
|
|
2941
|
+
if (value <= -180)
|
|
2942
|
+
return "Bearing must be greater then -180 degrees";
|
|
2943
|
+
return null;
|
|
2944
|
+
} }, init.cellEditorParams) });
|
|
2945
|
+
};
|
|
2925
2946
|
|
|
2926
2947
|
var MenuSeparatorString = "_____MENU_SEPARATOR_____";
|
|
2927
2948
|
Object.freeze({ value: MenuSeparatorString });
|
|
@@ -2962,6 +2983,29 @@ var GridFormDropDown = function (props) {
|
|
|
2962
2983
|
}
|
|
2963
2984
|
});
|
|
2964
2985
|
}); }, [formProps, props.field, props.selectedRows, updatingCells]);
|
|
2986
|
+
var selectFilterHandler = react.useCallback(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2987
|
+
var field;
|
|
2988
|
+
return __generator(this, function (_a) {
|
|
2989
|
+
switch (_a.label) {
|
|
2990
|
+
case 0:
|
|
2991
|
+
field = props.field;
|
|
2992
|
+
return [4 /*yield*/, updatingCells({ selectedRows: props.selectedRows, field: field }, function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2993
|
+
return __generator(this, function (_a) {
|
|
2994
|
+
switch (_a.label) {
|
|
2995
|
+
case 0:
|
|
2996
|
+
if (!formProps.onSelectFilter) return [3 /*break*/, 2];
|
|
2997
|
+
return [4 /*yield*/, formProps.onSelectFilter({ selectedRows: selectedRows, value: value })];
|
|
2998
|
+
case 1:
|
|
2999
|
+
_a.sent();
|
|
3000
|
+
_a.label = 2;
|
|
3001
|
+
case 2: return [2 /*return*/, true];
|
|
3002
|
+
}
|
|
3003
|
+
});
|
|
3004
|
+
}); })];
|
|
3005
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3006
|
+
}
|
|
3007
|
+
});
|
|
3008
|
+
}); }, [formProps, props.field, props.selectedRows, updatingCells]);
|
|
2965
3009
|
// Load up options list if it's async function
|
|
2966
3010
|
react.useEffect(function () {
|
|
2967
3011
|
var _a;
|
|
@@ -3036,22 +3080,29 @@ var GridFormDropDown = function (props) {
|
|
|
3036
3080
|
case 0:
|
|
3037
3081
|
if (!options)
|
|
3038
3082
|
return [2 /*return*/];
|
|
3039
|
-
if (!(e.key == "Enter" || e.key == "Tab")) return [3 /*break*/,
|
|
3083
|
+
if (!(e.key == "Enter" || e.key == "Tab")) return [3 /*break*/, 5];
|
|
3040
3084
|
activeOptions = options.filter(function (option) { return !filteredValues.includes(option.value); });
|
|
3041
3085
|
if (!(activeOptions.length == 1)) return [3 /*break*/, 2];
|
|
3042
3086
|
return [4 /*yield*/, selectItemHandler(activeOptions[0].value)];
|
|
3043
3087
|
case 1:
|
|
3044
3088
|
_a.sent();
|
|
3045
3089
|
stopEditing();
|
|
3046
|
-
return [3 /*break*/,
|
|
3090
|
+
return [3 /*break*/, 5];
|
|
3047
3091
|
case 2:
|
|
3092
|
+
if (!formProps.onSelectFilter) return [3 /*break*/, 4];
|
|
3093
|
+
return [4 /*yield*/, selectFilterHandler(filter)];
|
|
3094
|
+
case 3:
|
|
3095
|
+
_a.sent();
|
|
3096
|
+
stopEditing();
|
|
3097
|
+
return [3 /*break*/, 5];
|
|
3098
|
+
case 4:
|
|
3048
3099
|
e.preventDefault();
|
|
3049
3100
|
e.stopPropagation();
|
|
3050
|
-
_a.label =
|
|
3051
|
-
case
|
|
3101
|
+
_a.label = 5;
|
|
3102
|
+
case 5: return [2 /*return*/];
|
|
3052
3103
|
}
|
|
3053
3104
|
});
|
|
3054
|
-
}); }, [filteredValues, options, selectItemHandler, stopEditing]);
|
|
3105
|
+
}); }, [filteredValues, options, selectItemHandler, selectFilterHandler, stopEditing, filter, formProps]);
|
|
3055
3106
|
return popoverWrapper(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [formProps.filtered && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
|
|
3056
3107
|
var _b;
|
|
3057
3108
|
var ref = _a.ref;
|