@linzjs/step-ag-grid 7.0.3 → 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -15
- package/dist/index.js.map +1 -1
- package/dist/src/contexts/GridPopoverContext.d.ts +1 -7
- package/dist/step-ag-grid.esm.js +13 -15
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridCell.tsx +1 -1
- package/src/components/gridForm/GridFormEditBearing.tsx +3 -3
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +0 -1
- package/src/components/gridRender/GridRenderGenericCell.tsx +3 -8
- package/src/contexts/GridPopoverContext.tsx +2 -8
- package/src/contexts/GridPopoverContextProvider.tsx +1 -0
- package/src/stories/grid/GridPopoutBearing.stories.tsx +15 -15
- package/src/utils/bearing.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -2363,7 +2363,8 @@ var GridPopoverContext = react.createContext({
|
|
|
2363
2363
|
selectedRows: [],
|
|
2364
2364
|
updateValue: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
2365
2365
|
return [2 /*return*/, false];
|
|
2366
|
-
}); }); }
|
|
2366
|
+
}); }); },
|
|
2367
|
+
formatValue: function () { return "! No gridPopoverContextProvider !"; }
|
|
2367
2368
|
});
|
|
2368
2369
|
var useGridPopoverContext = function () {
|
|
2369
2370
|
return react.useContext(GridPopoverContext);
|
|
@@ -2412,7 +2413,8 @@ var GridPopoverContextProvider = function (_a) {
|
|
|
2412
2413
|
field: field,
|
|
2413
2414
|
data: props.data,
|
|
2414
2415
|
value: props.value,
|
|
2415
|
-
updateValue: updateValue
|
|
2416
|
+
updateValue: updateValue,
|
|
2417
|
+
formatValue: props.formatValue
|
|
2416
2418
|
} }, { children: children })));
|
|
2417
2419
|
};
|
|
2418
2420
|
|
|
@@ -2854,13 +2856,9 @@ var GridRendererGenericCell = function (props) {
|
|
|
2854
2856
|
var warningText = warningFn ? warningFn(props) : undefined;
|
|
2855
2857
|
var infoFn = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.info;
|
|
2856
2858
|
var infoText = infoFn ? infoFn(props) : undefined;
|
|
2857
|
-
var defaultFormatter = function (
|
|
2858
|
-
var formatter = (_a =
|
|
2859
|
-
|
|
2860
|
-
console.error("valueFormatter must be a function");
|
|
2861
|
-
return jsxRuntime.jsx("span", { children: "valueFormatter must be a function" });
|
|
2862
|
-
}
|
|
2863
|
-
var formatted = formatter(props);
|
|
2859
|
+
var defaultFormatter = function (value) { return value; };
|
|
2860
|
+
var formatter = (_a = props.formatValue) !== null && _a !== void 0 ? _a : defaultFormatter;
|
|
2861
|
+
var formatted = formatter(props.value);
|
|
2864
2862
|
return (jsxRuntime.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: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [typeof warningText === "string" && jsxRuntime.jsx(GridIcon, { icon: "ic_warning", title: warningText }), typeof infoText === "string" && jsxRuntime.jsx(GridIcon, { icon: "ic_info", title: infoText }), jsxRuntime.jsx("span", __assign({ title: formatted }, { children: formatted }))] }) })));
|
|
2865
2863
|
};
|
|
2866
2864
|
|
|
@@ -2894,7 +2892,7 @@ var GridCell = function (props, custom) {
|
|
|
2894
2892
|
// Default value formatter, otherwise react freaks out on objects
|
|
2895
2893
|
valueFormatter: function (params) {
|
|
2896
2894
|
if (params.value == null)
|
|
2897
|
-
return "
|
|
2895
|
+
return "–";
|
|
2898
2896
|
var types = ["number", "boolean", "string"];
|
|
2899
2897
|
if (types.includes(typeof params.value))
|
|
2900
2898
|
return "".concat(params.value);
|
|
@@ -3820,14 +3818,14 @@ var GridPopoverMenu = function (colDef, custom) {
|
|
|
3820
3818
|
var bearingValueFormatter = function (params) {
|
|
3821
3819
|
var value = typeof params.value == "string" ? parseFloat(params.value) : params.value;
|
|
3822
3820
|
if (value == null) {
|
|
3823
|
-
return "
|
|
3821
|
+
return "–";
|
|
3824
3822
|
}
|
|
3825
3823
|
return convertDDToDMS(value, false, false);
|
|
3826
3824
|
};
|
|
3827
3825
|
var bearingCorrectionValueFormatter = function (params) {
|
|
3828
3826
|
var value = params.value;
|
|
3829
3827
|
if (value == null) {
|
|
3830
|
-
return "
|
|
3828
|
+
return "–";
|
|
3831
3829
|
}
|
|
3832
3830
|
if (typeof value === "string") {
|
|
3833
3831
|
return convertDDToDMS(bearingNumberParser(value), true, true);
|
|
@@ -3909,7 +3907,7 @@ var TextInputFormatted = function (props) {
|
|
|
3909
3907
|
};
|
|
3910
3908
|
|
|
3911
3909
|
var GridFormEditBearing = function (props) {
|
|
3912
|
-
var _a = useGridPopoverContext(), field = _a.field, initialValue = _a.value;
|
|
3910
|
+
var _a = useGridPopoverContext(), field = _a.field, initialValue = _a.value, formatValue = _a.formatValue;
|
|
3913
3911
|
// This clears out any scientific precision
|
|
3914
3912
|
var defaultValue = react.useMemo(function () { return (initialValue == null ? "" : parseFloat(parseFloat(initialValue).toFixed(10)).toString()); }, [initialValue]);
|
|
3915
3913
|
var _b = react.useState(defaultValue), value = _b[0], setValue = _b[1];
|
|
@@ -3948,11 +3946,11 @@ var GridFormEditBearing = function (props) {
|
|
|
3948
3946
|
}).popoverWrapper;
|
|
3949
3947
|
return popoverWrapper(jsxRuntime.jsx("div", __assign({ className: "GridFormEditBearing-input Grid-popoverContainer" }, { children: jsxRuntime.jsx(TextInputFormatted, { value: defaultValue, onChange: function (e) {
|
|
3950
3948
|
setValue(e.target.value.trim());
|
|
3951
|
-
}, autoFocus: true, placeholder: props.placeHolder, formatted: bearingStringValidator(value, props.range) ? "?" :
|
|
3949
|
+
}, autoFocus: true, placeholder: props.placeHolder, formatted: bearingStringValidator(value, props.range) ? "?" : formatValue(bearingNumberParser(value)), error: bearingStringValidator(value, props.range), helpText: "Press enter or tab to save" }) })));
|
|
3952
3950
|
};
|
|
3953
3951
|
|
|
3954
3952
|
var GridPopoverEditBearingLike = function (colDef, props) {
|
|
3955
|
-
return GridCell(__assign({ initialWidth: 65, maxWidth: 150
|
|
3953
|
+
return GridCell(__assign({ initialWidth: 65, maxWidth: 150 }, colDef), __assign({ editor: GridFormEditBearing }, props));
|
|
3956
3954
|
};
|
|
3957
3955
|
var GridPopoverEditBearing = function (colDef, props) {
|
|
3958
3956
|
return GridPopoverEditBearingLike(__assign({ valueFormatter: bearingValueFormatter }, colDef), {
|