@linzjs/step-ag-grid 28.3.0 → 28.4.1

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.
@@ -3233,11 +3233,8 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
3233
3233
  event.api.forEachNode(() => rowCount++);
3234
3234
  return (jsx(GridNoRowsOverlay, { loading: !rowData || params.loading === true, rowCount: rowCount, headerRowHeight: headerRowCount * rowHeight, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText, noRowsMatchingOverlayText: params.noRowsMatchingOverlayText }));
3235
3235
  }, quickFilterParser: (filterStr) => {
3236
- filterStr = filterStr.trim();
3237
- const quoted = filterStr.startsWith('"');
3238
- filterStr = filterStr.replace(/^"/, '').replace(/"$/, '');
3239
- // If the user encloses the search term in quotes, treat it as an exact match otherwise split by space
3240
- return quoted ? [filterStr] : filterStr.split(' ');
3236
+ // filter is exact matches exactly groups separated by commas
3237
+ return filterStr.split(',').map((str) => str.trim());
3241
3238
  }, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragCancel: clearHighlightRowClasses, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData, selectionColumnDef: {
3242
3239
  suppressNavigable: params.hideSelectColumn,
3243
3240
  rowDrag: !!params.onRowDragEnd,
@@ -3332,7 +3329,7 @@ const GridCellMultiSelectClassRules = {
3332
3329
  },
3333
3330
  };
3334
3331
 
3335
- 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') }));
3336
3333
 
3337
3334
  const GridLoadableCell = () => (jsx(LuiMiniSpinner, { size: 22, divProps: { className: 'GridLoadableCell-container', role: 'status', 'aria-label': 'Loading' } }));
3338
3335
 
@@ -3361,24 +3358,21 @@ const suppressCellKeyboardEvents = (e) => {
3361
3358
  // as the incorrect selected rows will be returned
3362
3359
  return !['ArrowLeft', 'ArrowRight', 'ArrowDown', 'ArrowUp', 'Tab', ' ', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.event.key);
3363
3360
  };
3364
- const generateFilterGetter = (field, filterValueGetter, valueFormatter) => {
3365
- if (filterValueGetter)
3366
- return filterValueGetter;
3361
+ const generateFilterGetter = (valueFormatter) => {
3367
3362
  // aggrid will default to valueGetter
3368
- if (typeof valueFormatter !== 'function' || !field)
3363
+ if (typeof valueFormatter !== 'function') {
3369
3364
  return undefined;
3370
- return (params) => {
3371
- const value = params.getValue(field);
3372
- let formattedValue = valueFormatter({ ...params, value });
3373
- // Search for null values using standard dash
3374
- if (formattedValue === '–')
3375
- formattedValue += ' -';
3376
- // Search by raw value as well as formatted
3377
- const gotValue = ['string', 'number'].includes(typeof value) ? value : undefined;
3378
- return (formattedValue + (gotValue != null && formattedValue != gotValue ? ' ' + gotValue : '')) //
3379
- .replace(/\s+/g, ' ')
3380
- .trim();
3381
- };
3365
+ }
3366
+ return (params) => valueFormatter(params);
3367
+ };
3368
+ const stringableValueFormatterTypes = ['number', 'boolean', 'string'];
3369
+ const defaultValueFormatter = ({ value }) => {
3370
+ if (value == null) {
3371
+ return '–';
3372
+ }
3373
+ return stringableValueFormatterTypes.includes(typeof value) //
3374
+ ? String(value)
3375
+ : JSON.stringify(value);
3382
3376
  };
3383
3377
  /*
3384
3378
  * All cells should use this.
@@ -3388,16 +3382,17 @@ const GridCell = (props, custom) => {
3388
3382
  // Generate a default filter value getter which uses the formatted value plus
3389
3383
  // the editable value if it's a string and different from the formatted value.
3390
3384
  // This is so that e.g. bearings can be searched for by DMS or raw number.
3391
- const valueFormatter = props.valueFormatter;
3385
+ const valueFormatter = props.valueFormatter ?? defaultValueFormatter;
3392
3386
  // FIXME
3393
- const filterValueGetter = generateFilterGetter(props.field, props.filterValueGetter, valueFormatter);
3387
+ const filterValueGetter = props.filterValueGetter ?? generateFilterGetter(valueFormatter);
3394
3388
  const exportable = props.exportable;
3395
3389
  // Can't leave this here ag-grid will complain
3396
3390
  delete props.exportable;
3397
3391
  return {
3398
- colId: props.field ?? props.field,
3392
+ // Will be overridden if specified later
3393
+ colId: props.field,
3399
3394
  headerTooltip: props.headerName,
3400
- sortable: !!(props?.field || props?.valueGetter),
3395
+ sortable: true,
3401
3396
  resizable: true,
3402
3397
  editable: props.editable ?? false,
3403
3398
  ...(custom?.editor && {
@@ -3414,18 +3409,9 @@ const GridCell = (props, custom) => {
3414
3409
  },
3415
3410
  }),
3416
3411
  // If there's a valueFormatter and no filterValueGetter then create a filterValueGetter
3417
- // FIXME
3418
- filterValueGetter: filterValueGetter,
3412
+ getQuickFilterText: filterValueGetter,
3419
3413
  // Default value formatter, otherwise react freaks out on objects
3420
- valueFormatter: (params) => {
3421
- if (params.value == null)
3422
- return '–';
3423
- const types = ['number', 'boolean', 'string'];
3424
- if (types.includes(typeof params.value))
3425
- return `${params.value}`;
3426
- else
3427
- return JSON.stringify(params.value);
3428
- },
3414
+ valueFormatter,
3429
3415
  ...props,
3430
3416
  cellRenderer: typeof props.cellRenderer === 'string' ? props.cellRenderer : GridCellRenderer,
3431
3417
  cellRendererParams: {
@@ -5858,5 +5844,5 @@ const useDeferredPromise = () => {
5858
5844
  };
5859
5845
  };
5860
5846
 
5861
- 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 };
5847
+ 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 };
5862
5848
  //# sourceMappingURL=step-ag-grid.esm.js.map