diff --git a/frontend/src/Editor/Components/Table/columns/index.jsx b/frontend/src/Editor/Components/Table/columns/index.jsx index 1e58d88cb6..0775f49f4f 100644 --- a/frontend/src/Editor/Components/Table/columns/index.jsx +++ b/frontend/src/Editor/Components/Table/columns/index.jsx @@ -151,6 +151,70 @@ export default function generateColumnsData({ } return {cellValue}; } + case 'number': { + const textColor = resolveReferences(column.textColor, currentState, '', { cellValue, rowData }); + + const cellStyles = { + color: textColor ?? '', + }; + + if (column.isEditable) { + const validationData = validateWidget({ + validationObject: { + minValue: { + value: column.minValue, + }, + maxValue: { + value: column.maxValue, + }, + }, + widgetValue: cellValue, + currentState, + customResolveObjects: { cellValue }, + }); + + const { isValid, validationError } = validationData; + console.log('validationData', column.minValue, column.maxValue, validationData); + const cellStyles = { + color: textColor ?? '', + }; + + return ( +
+ { + if (e.key === 'Enter') { + if (e.target.defaultValue !== e.target.value) { + handleCellValueChange( + cell.row.index, + column.key || column.name, + Number(e.target.value), + cell.row.original + ); + } + } + }} + onBlur={(e) => { + if (e.target.defaultValue !== e.target.value) { + handleCellValueChange( + cell.row.index, + column.key || column.name, + Number(e.target.value), + cell.row.original + ); + } + }} + className={`form-control-plaintext form-control-plaintext-sm ${!isValid ? 'is-invalid' : ''}`} + defaultValue={cellValue} + /> +
{validationError}
+
+ ); + } + return {cellValue}; + } case 'text': { return (