@linzjs/step-ag-grid 29.0.0 → 29.0.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.
@@ -3377,16 +3377,18 @@ const defaultValueFormatter = ({ value }) => {
3377
3377
  ? String(value)
3378
3378
  : JSON.stringify(value);
3379
3379
  };
3380
+ // ag-grid doesn't understand the custom editor, when it stops editing it thinks
3381
+ // that _it_ was editing and overwrites the user updated data
3382
+ // _but_, it only does this if the initial value of the cell was null!?
3383
+ const blockValueSetter = () => true;
3380
3384
  /*
3381
3385
  * All cells should use this.
3382
3386
  */
3383
3387
  const GridCell = (props, custom) => {
3384
- // props.field = ;
3385
3388
  // Generate a default filter value getter which uses the formatted value plus
3386
3389
  // the editable value if it's a string and different from the formatted value.
3387
3390
  // This is so that e.g. bearings can be searched for by DMS or raw number.
3388
3391
  const valueFormatter = props.valueFormatter ?? defaultValueFormatter;
3389
- // FIXME
3390
3392
  const filterValueGetter = props.filterValueGetter ?? generateFilterGetter(valueFormatter);
3391
3393
  const exportable = props.exportable;
3392
3394
  // Can't leave this here ag-grid will complain
@@ -3397,6 +3399,7 @@ const GridCell = (props, custom) => {
3397
3399
  headerTooltip: props.headerName,
3398
3400
  sortable: true,
3399
3401
  resizable: true,
3402
+ valueSetter: custom?.editor ? blockValueSetter : undefined,
3400
3403
  editable: props.editable ?? false,
3401
3404
  ...(custom?.editor && {
3402
3405
  cellClassRules: GridCellMultiSelectClassRules,
@@ -4836,12 +4839,14 @@ const GridFormTextInput = (props) => {
4836
4839
  const [value, setValue] = React.useState(initValue);
4837
4840
  const invalid = React.useCallback(() => TextInputValidator(props, value, data, {}), [data, props, value]);
4838
4841
  const save = React.useCallback(async (selectedRows) => {
4839
- if (invalid())
4842
+ if (invalid()) {
4840
4843
  return false;
4844
+ }
4841
4845
  const trimmedValue = value.trim();
4842
4846
  // No change, so don't save
4843
- if (initValue === trimmedValue)
4847
+ if (initValue === trimmedValue) {
4844
4848
  return true;
4849
+ }
4845
4850
  if (props.onSave) {
4846
4851
  return await props.onSave({ selectedRows, value: trimmedValue });
4847
4852
  }