@linzjs/step-ag-grid 28.4.0 → 28.4.2

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.
@@ -3329,7 +3329,7 @@ const GridCellMultiSelectClassRules = {
3329
3329
  },
3330
3330
  };
3331
3331
 
3332
- const GridIcon = (props) => (jsx(LuiIcon, { name: props.icon, title: props.title, alt: props.title, size: props.size ?? 'md', className: clsx(`AgGridGenericCellRenderer-${props.icon}Icon`, props.className, props.disabled && 'GridIcon-disabled') }));
3332
+ const GridIcon = (props) => (jsx(LuiIcon, { name: props.icon, title: props.title, alt: props.title, size: props.size ?? 'md', className: clsx(`step-ag-grid__alert-icon`, `AgGridGenericCellRenderer-${props.icon}Icon`, props.className, props.disabled && 'GridIcon-disabled') }));
3333
3333
 
3334
3334
  const GridLoadableCell = () => (jsx(LuiMiniSpinner, { size: 22, divProps: { className: 'GridLoadableCell-container', role: 'status', 'aria-label': 'Loading' } }));
3335
3335
 
@@ -3341,11 +3341,13 @@ const GridCellRenderer = (props) => {
3341
3341
  let warningText = props.data !== undefined && warningFn ? warningFn(props) : undefined;
3342
3342
  const infoFn = rendererParams?.info;
3343
3343
  let infoText = props.data !== undefined && infoFn ? infoFn(props) : undefined;
3344
- if (Array.isArray(warningText))
3344
+ if (Array.isArray(warningText)) {
3345
3345
  warningText = warningText.join('\n');
3346
- if (Array.isArray(infoText))
3346
+ }
3347
+ if (Array.isArray(infoText)) {
3347
3348
  infoText = infoText.join('\n');
3348
- return checkUpdating(colDef.field ?? colDef.colId ?? '', props.data.id) ? (jsx(GridLoadableCell, {})) : (jsxs(Fragment, { children: [!!warningText && (jsx(GridIcon, { icon: 'ic_warning_outline', title: typeof warningText === 'string' ? warningText : 'Warning' })), !!infoText && jsx(GridIcon, { icon: 'ic_info_outline', title: typeof infoText === 'string' ? infoText : 'Info' }), jsx("div", { className: 'GridCell-container', children: colDef.cellRendererParams?.originalCellRenderer ? (jsx(colDef.cellRendererParams.originalCellRenderer, { ...props })) : (jsx("span", { title: props.valueFormatted ?? undefined, children: props.valueFormatted })) }), fnOrVar(colDef.editable, props) && rendererParams?.rightHoverElement && (jsx("div", { className: 'GridCell-hoverRight', children: rendererParams?.rightHoverElement }))] }));
3349
+ }
3350
+ return checkUpdating(colDef.field ?? colDef.colId ?? '', props.data.id) ? (jsx(GridLoadableCell, {})) : (jsxs(Fragment, { children: [!!warningText && (jsx(GridIcon, { icon: 'ic_warning_outline', title: typeof warningText === 'string' ? warningText : 'Warning' })), !!infoText && jsx(GridIcon, { icon: 'ic_info_outline', title: typeof infoText === 'string' ? infoText : 'Info' }), jsx("div", { className: 'GridCell-container', children: colDef.cellRendererParams?.originalCellRenderer ? (jsx(colDef.cellRendererParams.originalCellRenderer, { ...props })) : (jsx("span", { title: props.valueFormatted ?? undefined, children: props.valueFormatted || '–' })) }), fnOrVar(colDef.editable, props) && rendererParams?.rightHoverElement && (jsx("div", { className: 'GridCell-hoverRight', children: rendererParams?.rightHoverElement }))] }));
3349
3351
  };
3350
3352
  const suppressCellKeyboardEvents = (e) => {
3351
3353
  const shortcutKeys = e.colDef.cellRendererParams?.shortcutKeys ?? {};
@@ -3358,24 +3360,21 @@ const suppressCellKeyboardEvents = (e) => {
3358
3360
  // as the incorrect selected rows will be returned
3359
3361
  return !['ArrowLeft', 'ArrowRight', 'ArrowDown', 'ArrowUp', 'Tab', ' ', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.event.key);
3360
3362
  };
3361
- const generateFilterGetter = (field, filterValueGetter, valueFormatter) => {
3362
- if (filterValueGetter)
3363
- return filterValueGetter;
3363
+ const generateFilterGetter = (valueFormatter) => {
3364
3364
  // aggrid will default to valueGetter
3365
- if (typeof valueFormatter !== 'function' || !field)
3365
+ if (typeof valueFormatter !== 'function') {
3366
3366
  return undefined;
3367
- return (params) => {
3368
- const value = params.getValue(field);
3369
- let formattedValue = valueFormatter({ ...params, value });
3370
- // Search for null values using standard dash
3371
- if (formattedValue === '–')
3372
- formattedValue += ' -';
3373
- // Search by raw value as well as formatted
3374
- const gotValue = ['string', 'number'].includes(typeof value) ? value : undefined;
3375
- return (formattedValue + (gotValue != null && formattedValue != gotValue ? ' ' + gotValue : '')) //
3376
- .replace(/\s+/g, ' ')
3377
- .trim();
3378
- };
3367
+ }
3368
+ return (params) => valueFormatter(params);
3369
+ };
3370
+ const stringableValueFormatterTypes = ['number', 'boolean', 'string'];
3371
+ const defaultValueFormatter = ({ value }) => {
3372
+ if (value == null) {
3373
+ return '–';
3374
+ }
3375
+ return stringableValueFormatterTypes.includes(typeof value) //
3376
+ ? String(value)
3377
+ : JSON.stringify(value);
3379
3378
  };
3380
3379
  /*
3381
3380
  * All cells should use this.
@@ -3385,16 +3384,17 @@ const GridCell = (props, custom) => {
3385
3384
  // Generate a default filter value getter which uses the formatted value plus
3386
3385
  // the editable value if it's a string and different from the formatted value.
3387
3386
  // This is so that e.g. bearings can be searched for by DMS or raw number.
3388
- const valueFormatter = props.valueFormatter;
3387
+ const valueFormatter = props.valueFormatter ?? defaultValueFormatter;
3389
3388
  // FIXME
3390
- const filterValueGetter = generateFilterGetter(props.field, props.filterValueGetter, valueFormatter);
3389
+ const filterValueGetter = props.filterValueGetter ?? generateFilterGetter(valueFormatter);
3391
3390
  const exportable = props.exportable;
3392
3391
  // Can't leave this here ag-grid will complain
3393
3392
  delete props.exportable;
3394
3393
  return {
3395
- colId: props.field ?? props.field,
3394
+ // Will be overridden if specified later
3395
+ colId: props.field,
3396
3396
  headerTooltip: props.headerName,
3397
- sortable: !!(props?.field || props?.valueGetter),
3397
+ sortable: true,
3398
3398
  resizable: true,
3399
3399
  editable: props.editable ?? false,
3400
3400
  ...(custom?.editor && {
@@ -3411,18 +3411,9 @@ const GridCell = (props, custom) => {
3411
3411
  },
3412
3412
  }),
3413
3413
  // If there's a valueFormatter and no filterValueGetter then create a filterValueGetter
3414
- // FIXME
3415
- filterValueGetter: filterValueGetter,
3414
+ getQuickFilterText: filterValueGetter,
3416
3415
  // Default value formatter, otherwise react freaks out on objects
3417
- valueFormatter: (params) => {
3418
- if (params.value == null)
3419
- return '–';
3420
- const types = ['number', 'boolean', 'string'];
3421
- if (types.includes(typeof params.value))
3422
- return `${params.value}`;
3423
- else
3424
- return JSON.stringify(params.value);
3425
- },
3416
+ valueFormatter,
3426
3417
  ...props,
3427
3418
  cellRenderer: typeof props.cellRenderer === 'string' ? props.cellRenderer : GridCellRenderer,
3428
3419
  cellRendererParams: {
@@ -5855,5 +5846,5 @@ const useDeferredPromise = () => {
5855
5846
  };
5856
5847
  };
5857
5848
 
5858
- export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridButton, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridEditBoolean, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridNoRowsOverlayFr, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, TextInputValidator, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, primitiveToSelectOption, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, textMatch, useDeferredPromise, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
5849
+ export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridButton, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridEditBoolean, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridNoRowsOverlayFr, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, TextInputValidator, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, convertDDToDMS, defaultValueFormatter, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, primitiveToSelectOption, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, textMatch, useDeferredPromise, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
5859
5850
  //# sourceMappingURL=step-ag-grid.esm.js.map