@linzjs/step-ag-grid 28.4.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.
- package/dist/index.css +5 -0
- package/dist/src/components/GridCell.d.ts +4 -3
- package/dist/step-ag-grid.cjs +22 -32
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +22 -33
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +8 -6
- package/src/components/GridCell.test.tsx +27 -25
- package/src/components/GridCell.tsx +29 -29
- package/src/components/GridIcon.tsx +1 -0
- package/src/styles/Grid.scss +5 -0
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -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
|
|
|
@@ -3358,24 +3358,21 @@ const suppressCellKeyboardEvents = (e) => {
|
|
|
3358
3358
|
// as the incorrect selected rows will be returned
|
|
3359
3359
|
return !['ArrowLeft', 'ArrowRight', 'ArrowDown', 'ArrowUp', 'Tab', ' ', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.event.key);
|
|
3360
3360
|
};
|
|
3361
|
-
const generateFilterGetter = (
|
|
3362
|
-
if (filterValueGetter)
|
|
3363
|
-
return filterValueGetter;
|
|
3361
|
+
const generateFilterGetter = (valueFormatter) => {
|
|
3364
3362
|
// aggrid will default to valueGetter
|
|
3365
|
-
if (typeof valueFormatter !== 'function'
|
|
3363
|
+
if (typeof valueFormatter !== 'function') {
|
|
3366
3364
|
return undefined;
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
};
|
|
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);
|
|
3379
3376
|
};
|
|
3380
3377
|
/*
|
|
3381
3378
|
* All cells should use this.
|
|
@@ -3385,16 +3382,17 @@ const GridCell = (props, custom) => {
|
|
|
3385
3382
|
// Generate a default filter value getter which uses the formatted value plus
|
|
3386
3383
|
// the editable value if it's a string and different from the formatted value.
|
|
3387
3384
|
// This is so that e.g. bearings can be searched for by DMS or raw number.
|
|
3388
|
-
const valueFormatter = props.valueFormatter;
|
|
3385
|
+
const valueFormatter = props.valueFormatter ?? defaultValueFormatter;
|
|
3389
3386
|
// FIXME
|
|
3390
|
-
const filterValueGetter =
|
|
3387
|
+
const filterValueGetter = props.filterValueGetter ?? generateFilterGetter(valueFormatter);
|
|
3391
3388
|
const exportable = props.exportable;
|
|
3392
3389
|
// Can't leave this here ag-grid will complain
|
|
3393
3390
|
delete props.exportable;
|
|
3394
3391
|
return {
|
|
3395
|
-
|
|
3392
|
+
// Will be overridden if specified later
|
|
3393
|
+
colId: props.field,
|
|
3396
3394
|
headerTooltip: props.headerName,
|
|
3397
|
-
sortable:
|
|
3395
|
+
sortable: true,
|
|
3398
3396
|
resizable: true,
|
|
3399
3397
|
editable: props.editable ?? false,
|
|
3400
3398
|
...(custom?.editor && {
|
|
@@ -3411,18 +3409,9 @@ const GridCell = (props, custom) => {
|
|
|
3411
3409
|
},
|
|
3412
3410
|
}),
|
|
3413
3411
|
// If there's a valueFormatter and no filterValueGetter then create a filterValueGetter
|
|
3414
|
-
|
|
3415
|
-
filterValueGetter: filterValueGetter,
|
|
3412
|
+
getQuickFilterText: filterValueGetter,
|
|
3416
3413
|
// Default value formatter, otherwise react freaks out on objects
|
|
3417
|
-
valueFormatter
|
|
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
|
-
},
|
|
3414
|
+
valueFormatter,
|
|
3426
3415
|
...props,
|
|
3427
3416
|
cellRenderer: typeof props.cellRenderer === 'string' ? props.cellRenderer : GridCellRenderer,
|
|
3428
3417
|
cellRendererParams: {
|
|
@@ -5855,5 +5844,5 @@ const useDeferredPromise = () => {
|
|
|
5855
5844
|
};
|
|
5856
5845
|
};
|
|
5857
5846
|
|
|
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 };
|
|
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 };
|
|
5859
5848
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|