@linzjs/step-ag-grid 1.4.7 → 1.4.8

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.
@@ -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: (cellRendererParams: ICellRendererParams) => JSX.Element;
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;
@@ -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, _d, _e, _f, _g;
871
+ var _a, _b, _c;
872
872
  var checkUpdating = useContext(UpdatingContext).checkUpdating;
873
- var cellRendererParams = (_a = props.colDef) === null || _a === void 0 ? void 0 : _a.cellRendererParams;
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 = (_c = (_b = props.colDef) === null || _b === void 0 ? void 0 : _b.valueFormatter) !== null && _c !== void 0 ? _c : defaultFormatter;
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((_g = (_e = (_d = props.colDef) === null || _d === void 0 ? void 0 : _d.field) !== null && _e !== void 0 ? _e : (_f = props.colDef) === null || _f === void 0 ? void 0 : _f.colId) !== null && _g !== void 0 ? _g : "", 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
+ 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 (cellRendererParams) {
889
- var _a, _b, _c, _d, _e;
889
+ var GridCellRenderer = function (props) {
890
+ var _a, _b, _c;
890
891
  var checkUpdating = useContext(UpdatingContext).checkUpdating;
891
- var colDef = cellRendererParams.colDef;
892
- return ((_a = colDef === null || colDef === void 0 ? void 0 : colDef.cellRendererParams) === null || _a === void 0 ? void 0 : _a.oldCellRenderer) ? (jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((_e = (_c = (_b = cellRendererParams.colDef) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : (_d = cellRendererParams.colDef) === null || _d === void 0 ? void 0 : _d.colId) !== null && _e !== void 0 ? _e : "", cellRendererParams.data.id) }, { children: jsx(colDef.cellRendererParams.oldCellRenderer, __assign({}, cellRendererParams)) }))) : (jsx(GridRendererGenericCell, __assign({}, cellRendererParams)));
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({ cellRenderer: GridCellRenderer, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, (props.cellEditorParams && {
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
- })), props), { cellRendererParams: __assign({ originalCellRender: props.cellRenderer }, props.cellRendererParams) });
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