Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

[Feature] Extend CellState.filteredCellValue() to allow implement custom PlutoColumnType with proper set new value checks. #132

@slavap

Description

@slavap

Currently there is the following code in CellState.filteredCellValue()

if (column.type.isSelect) {
      return column.type.select.items.contains(newValue) == true
          ? newValue
          : oldValue;
    }

When I'm implementing some custom PlutoColumnType, I would like to have an ability to check newValue by myself.
Please add the following method to PlutoColumnType:

(bool, dynamic) filteredValue({
    dynamic newValue,
    dynamic oldValue,
  }) => (false, newValue);

so I can override it in my custom PlutoColumnType.
And call it from the CellState.filteredCellValue() as the first statement:

final typeResult = column.type.filteredValue(oldValue: oldValue, newValue: newValue);
if (typeResult.$1) return typeResult.$2; 

//... rest of current CellState.filteredCellValue() code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions