mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 16:38:21 +00:00
Bugfix: tags table-cell-type cannot be edited if its readOnly (#806)
* tags and badges:table-cell-type cannot be edited if its readOnly * going backward for badge and badges type
This commit is contained in:
parent
c17b76e5ea
commit
ab17ead153
2 changed files with 9 additions and 6 deletions
|
|
@ -266,7 +266,7 @@ export function Table({
|
|||
|
||||
if (Array.isArray(labels)) {
|
||||
columnOptions.selectOptions = labels.map((label, index) => {
|
||||
return { name: label, value: values[index] };
|
||||
return { name: label, value: values[index]};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -432,6 +432,7 @@ export function Table({
|
|||
return (
|
||||
<div>
|
||||
<Tags
|
||||
readOnly={!column.isEditable}
|
||||
value={cellValue}
|
||||
onChange={(value) => {
|
||||
handleCellValueChange(cell.row.index, column.key || column.name, value, cell.row.original);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState } from 'react';
|
||||
|
||||
export const Tags = ({ value, onChange }) => {
|
||||
export const Tags = ({ value, onChange, readOnly }) => {
|
||||
|
||||
value = value || [];
|
||||
|
||||
|
|
@ -30,9 +30,11 @@ export const Tags = ({ value, onChange }) => {
|
|||
function renderTag(text) {
|
||||
return <span className="col-auto badge bg-blue-lt p-2 mx-1 tag mb-2">
|
||||
{text}
|
||||
<span className="badge badge-pill bg-red-lt remove-tag-button" onClick={() => removeTag(text)}>
|
||||
x
|
||||
</span>
|
||||
{!readOnly && (
|
||||
<span className="badge badge-pill bg-red-lt remove-tag-button" onClick={() => removeTag(text)}>
|
||||
x
|
||||
</span>
|
||||
)}
|
||||
</span>;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +44,7 @@ export const Tags = ({ value, onChange }) => {
|
|||
return renderTag(item)
|
||||
})}
|
||||
|
||||
{!showForm &&
|
||||
{(!showForm && !readOnly) &&
|
||||
<span className="col-auto badge bg-green-lt mx-1 add-tag-button" onClick={() => setShowForm(true)}>{'+'}</span>
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue