@linzjs/step-ag-grid 29.8.0 → 29.9.0

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.css CHANGED
@@ -571,6 +571,16 @@ div.ag-ltr div.ag-header-cell-resize {
571
571
  fill: #EA6A2E;
572
572
  }
573
573
 
574
+ .AgGridGenericCellRenderer-ic_error_Icon {
575
+ margin-right: 4px;
576
+ fill: #cc0000;
577
+ }
578
+
579
+ .AgGridGenericCellRenderer-ic_error_outlineIcon {
580
+ margin-right: 4px;
581
+ fill: #cc0000;
582
+ }
583
+
574
584
  .GridIcon-disabled {
575
585
  fill: #beb9b4 !important;
576
586
  }
@@ -19,6 +19,7 @@ export interface ColDefT<TData extends GridBaseRow, ValueType = any> extends Col
19
19
  originalCellRenderer?: any;
20
20
  editAction?: (selectedRows: TData[]) => void;
21
21
  shortcutKeys?: Record<string, () => void>;
22
+ error?: (props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined;
22
23
  warning?: (props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined;
23
24
  info?: (props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined;
24
25
  };
@@ -10,6 +10,7 @@ export interface GenericCellRendererParams<TData extends GridBaseRow> {
10
10
  rightHoverElement?: ReactElement | undefined;
11
11
  editAction?: (selectedRows: TData[]) => void;
12
12
  shortcutKeys?: Record<string, ((params: SuppressKeyboardEventParams) => boolean | void) | undefined>;
13
+ error?: (props: ICellRendererParams<TData>) => string | string[] | boolean | null | undefined;
13
14
  warning?: (props: ICellRendererParams<TData>) => string | string[] | boolean | null | undefined;
14
15
  info?: (props: ICellRendererParams<TData>) => string | string[] | boolean | null | undefined;
15
16
  }
@@ -3454,17 +3454,22 @@ const GridCellRenderer = (props) => {
3454
3454
  const { checkUpdating } = React.useContext(GridUpdatingContext);
3455
3455
  const colDef = props.colDef;
3456
3456
  const rendererParams = colDef.cellRendererParams;
3457
+ const errorFn = rendererParams?.error;
3458
+ let errorText = props.data !== undefined && errorFn ? errorFn(props) : undefined;
3457
3459
  const warningFn = rendererParams?.warning;
3458
3460
  let warningText = props.data !== undefined && warningFn ? warningFn(props) : undefined;
3459
3461
  const infoFn = rendererParams?.info;
3460
3462
  let infoText = props.data !== undefined && infoFn ? infoFn(props) : undefined;
3463
+ if (Array.isArray(errorText)) {
3464
+ errorText = errorText.join('\n');
3465
+ }
3461
3466
  if (Array.isArray(warningText)) {
3462
3467
  warningText = warningText.join('\n');
3463
3468
  }
3464
3469
  if (Array.isArray(infoText)) {
3465
3470
  infoText = infoText.join('\n');
3466
3471
  }
3467
- return checkUpdating(colDef.field ?? colDef.colId ?? '', props.data.id) ? (jsxRuntime.jsx(GridLoadableCell, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!warningText && (jsxRuntime.jsx(GridIcon, { icon: 'ic_warning_outline', title: typeof warningText === 'string' ? warningText : 'Warning' })), !!infoText && jsxRuntime.jsx(GridIcon, { icon: 'ic_info_outline', title: typeof infoText === 'string' ? infoText : 'Info' }), jsxRuntime.jsx("div", { className: 'GridCell-container', children: colDef.cellRendererParams?.originalCellRenderer ? (jsxRuntime.jsx(colDef.cellRendererParams.originalCellRenderer, { ...props })) : (jsxRuntime.jsx("span", { title: props.valueFormatted ?? undefined, children: props.valueFormatted || '–' })) }), fnOrVar(colDef.editable, props) && rendererParams?.rightHoverElement && (jsxRuntime.jsx("div", { className: 'GridCell-hoverRight', children: rendererParams?.rightHoverElement }))] }));
3472
+ return checkUpdating(colDef.field ?? colDef.colId ?? '', props.data.id) ? (jsxRuntime.jsx(GridLoadableCell, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!errorText && (jsxRuntime.jsx(GridIcon, { icon: 'ic_error_outline', title: typeof errorText === 'string' ? errorText : 'Error' })), !!warningText && (jsxRuntime.jsx(GridIcon, { icon: 'ic_warning_outline', title: typeof warningText === 'string' ? warningText : 'Warning' })), !!infoText && jsxRuntime.jsx(GridIcon, { icon: 'ic_info_outline', title: typeof infoText === 'string' ? infoText : 'Info' }), jsxRuntime.jsx("div", { className: 'GridCell-container', children: colDef.cellRendererParams?.originalCellRenderer ? (jsxRuntime.jsx(colDef.cellRendererParams.originalCellRenderer, { ...props })) : (jsxRuntime.jsx("span", { title: props.valueFormatted ?? undefined, children: props.valueFormatted || '–' })) }), fnOrVar(colDef.editable, props) && rendererParams?.rightHoverElement && (jsxRuntime.jsx("div", { className: 'GridCell-hoverRight', children: rendererParams?.rightHoverElement }))] }));
3468
3473
  };
3469
3474
  const suppressCellKeyboardEvents = (e) => {
3470
3475
  const shortcutKeys = e.colDef.cellRendererParams?.shortcutKeys ?? {};