@linzjs/step-ag-grid 1.4.7 → 1.4.9
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 +1 -0
- package/dist/index.js +34 -11
- package/dist/index.js.map +1 -1
- package/dist/src/components/GridCell.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormPopoutMenu.d.ts +1 -0
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +2 -2
- package/dist/step-ag-grid.esm.js +34 -12
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridCell.tsx +27 -14
- package/src/components/gridForm/GridFormPopoutMenu.tsx +11 -8
- package/src/components/gridRender/GridRenderGenericCell.tsx +6 -5
- package/src/stories/components/GridReadOnly.stories.tsx +6 -1
|
@@ -19,7 +19,7 @@ export interface GenericCellEditorColDef<RowType extends GridBaseRow, FormProps
|
|
|
19
19
|
cellEditorParams?: FormProps;
|
|
20
20
|
cellRendererParams?: GenericCellRendererParams<RowType>;
|
|
21
21
|
}
|
|
22
|
-
export declare const GridCellRenderer: (
|
|
22
|
+
export declare const GridCellRenderer: (props: ICellRendererParams) => JSX.Element;
|
|
23
23
|
/**
|
|
24
24
|
* For editing a text area.
|
|
25
25
|
*/
|
|
@@ -16,6 +16,7 @@ export interface MenuOption<RowType> {
|
|
|
16
16
|
action?: (selectedRows: RowType[]) => Promise<boolean>;
|
|
17
17
|
disabled?: string | boolean;
|
|
18
18
|
supportsMultiEdit: boolean;
|
|
19
|
+
hidden?: boolean;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* NOTE: If the popout menu doesn't appear on single click when also selecting row it's because
|
|
@@ -12,7 +12,7 @@ export interface GenericCellColDef<RowType extends GridBaseRow, FormProps extend
|
|
|
12
12
|
}
|
|
13
13
|
export interface GenericCellRendererParams<RowType extends GridBaseRow> {
|
|
14
14
|
singleClickEdit?: boolean;
|
|
15
|
-
warning?: (props: RowICellRendererParams<RowType>) => string | boolean | undefined;
|
|
16
|
-
info?: (props: RowICellRendererParams<RowType>) => string | boolean | undefined;
|
|
15
|
+
warning?: (props: RowICellRendererParams<RowType>) => string | boolean | null | undefined;
|
|
16
|
+
info?: (props: RowICellRendererParams<RowType>) => string | boolean | null | undefined;
|
|
17
17
|
}
|
|
18
18
|
export declare const GridRendererGenericCell: <RowType extends GridBaseRow>(props: ICellRendererParams) => JSX.Element;
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -868,39 +868,53 @@ var GridLoadableCell = function (props) {
|
|
|
868
868
|
var GridIcon = function (props) { return (jsx(LuiIcon, { name: props.icon, title: props.title, alt: props.title, size: "md", className: "AgGridGenericCellRenderer-".concat(props.icon, "Icon") })); };
|
|
869
869
|
|
|
870
870
|
var GridRendererGenericCell = function (props) {
|
|
871
|
-
var _a, _b, _c
|
|
871
|
+
var _a, _b, _c;
|
|
872
872
|
var checkUpdating = useContext(UpdatingContext).checkUpdating;
|
|
873
|
-
var
|
|
873
|
+
var colDef = props.colDef;
|
|
874
|
+
var cellRendererParams = colDef.cellRendererParams;
|
|
874
875
|
var warningFn = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.warning;
|
|
875
876
|
var warningText = warningFn ? warningFn(props) : undefined;
|
|
876
877
|
var infoFn = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.info;
|
|
877
878
|
var infoText = infoFn ? infoFn(props) : undefined;
|
|
878
879
|
var defaultFormatter = function (props) { return props.value; };
|
|
879
|
-
var formatter = (
|
|
880
|
+
var formatter = (_a = colDef.valueFormatter) !== null && _a !== void 0 ? _a : defaultFormatter;
|
|
880
881
|
if (typeof formatter === "string") {
|
|
881
882
|
console.error("valueFormatter must be a function");
|
|
882
883
|
return jsx("span", { children: "valueFormatter must be a function" });
|
|
883
884
|
}
|
|
884
885
|
var formatted = formatter(props);
|
|
885
|
-
return (jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((
|
|
886
|
+
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, { 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 }))] }) })));
|
|
886
887
|
};
|
|
887
888
|
|
|
888
|
-
var GridCellRenderer = function (
|
|
889
|
-
var _a, _b, _c
|
|
889
|
+
var GridCellRenderer = function (props) {
|
|
890
|
+
var _a, _b, _c;
|
|
890
891
|
var checkUpdating = useContext(UpdatingContext).checkUpdating;
|
|
891
|
-
var colDef =
|
|
892
|
-
|
|
892
|
+
var colDef = props.colDef;
|
|
893
|
+
var rendererParams = colDef.cellRendererParams;
|
|
894
|
+
var warningFn = rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.warning;
|
|
895
|
+
var warningText = warningFn ? warningFn(props) : undefined;
|
|
896
|
+
var infoFn = rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.info;
|
|
897
|
+
var infoText = infoFn ? infoFn(props) : undefined;
|
|
898
|
+
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, { 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)));
|
|
893
899
|
};
|
|
894
900
|
/**
|
|
895
901
|
* For editing a text area.
|
|
896
902
|
*/
|
|
897
903
|
var GridCell = function (props) {
|
|
898
904
|
var _a;
|
|
899
|
-
return __assign(__assign(__assign({
|
|
905
|
+
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 && {
|
|
900
906
|
cellClass: ((_a = props === null || props === void 0 ? void 0 : props.cellEditorParams) === null || _a === void 0 ? void 0 : _a.multiEdit) ? GenericMultiEditCellClass : undefined,
|
|
901
907
|
editable: true,
|
|
902
908
|
cellEditor: GenericCellEditorComponent
|
|
903
|
-
})),
|
|
909
|
+
})), {
|
|
910
|
+
// Default value formatter, otherwise react freaks out on objects
|
|
911
|
+
valueFormatter: function (params) {
|
|
912
|
+
var types = ["number", "undefined", "boolean", "string"];
|
|
913
|
+
if (types.includes(typeof params.value))
|
|
914
|
+
return params.value;
|
|
915
|
+
else
|
|
916
|
+
return JSON.stringify(params.value);
|
|
917
|
+
} }), props), { cellRenderer: GridCellRenderer, cellRendererParams: __assign({ originalCellRenderer: props.cellRenderer }, props.cellRendererParams) });
|
|
904
918
|
};
|
|
905
919
|
var GenericCellEditorComponentFr = function (props, _) {
|
|
906
920
|
var _a, _b, _c;
|
|
@@ -2725,7 +2739,7 @@ var GridFormPopoutMenu = function (props) {
|
|
|
2725
2739
|
});
|
|
2726
2740
|
var popoverWrapper = useGridPopoverHook(props).popoverWrapper;
|
|
2727
2741
|
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) {
|
|
2728
|
-
return item.label === MenuSeparator ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : (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)));
|
|
2742
|
+
return item.label === MenuSeparator ? (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))));
|
|
2729
2743
|
}) })) })));
|
|
2730
2744
|
};
|
|
2731
2745
|
|
|
@@ -3192,5 +3206,13 @@ var GridPopoverTextInput = function (colDef) {
|
|
|
3192
3206
|
})));
|
|
3193
3207
|
};
|
|
3194
3208
|
|
|
3195
|
-
|
|
3209
|
+
var GridSubComponentTextArea = function (props) {
|
|
3210
|
+
var _a = useState(""), value = _a[0], setValue = _a[1];
|
|
3211
|
+
useEffect(function () {
|
|
3212
|
+
props.setValue(value);
|
|
3213
|
+
}, [props, value]);
|
|
3214
|
+
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 }) })));
|
|
3215
|
+
};
|
|
3216
|
+
|
|
3217
|
+
export { ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericMultiEditCellClass, Grid, GridCell, 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, SubMenu, TextAreaInput, TextInputFormatted, UpdatingContext, UpdatingContextProvider, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, convertDDToDMS, hasParentClass, isFloat, isNotEmpty, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
3196
3218
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|