"use strict";

exports.__esModule = true;
exports.textCellType = void 0;
var _types = require("../../types");
var _View = require("./View");
exports.TextView = _View.TextView;
var _Edit = require("./Edit");
exports.TextEdit = _Edit.TextEdit;
const textCellType = exports.textCellType = (0, _types.defineCellType)({
  type: 'text',
  ViewComponent: _View.TextView,
  EditComponent: _Edit.TextEdit,
  serialize: value => value ?? '',
  deserialize: raw => raw,
  editable: true,
  clearable: true,
  onTypeToEdit: ({
    key,
    validation
  }) => {
    const hasSpecificValues = validation == null ? void 0 : validation.some(r => r.type === 'specificValues');
    // For specific-values cells, keep editingValue as the last committed option id.
    // The typed key is forwarded via editTrigger.key so TextEditSpecificValues can
    // use it as initialSearchText without risk of committing a raw search string.
    return hasSpecificValues ? {} : {
      value: key
    };
  }
});
//# sourceMappingURL=index.js.map