diff --git a/frontend/src/metadata/components/cell-editors/editor-container/popup-editor-container.js b/frontend/src/metadata/components/cell-editors/editor-container/popup-editor-container.js index b2542d1a36..0394eec7f7 100644 --- a/frontend/src/metadata/components/cell-editors/editor-container/popup-editor-container.js +++ b/frontend/src/metadata/components/cell-editors/editor-container/popup-editor-container.js @@ -12,6 +12,8 @@ const NOT_SUPPORT_EDITOR_COLUMN_TYPES = [ CellType.CTIME, CellType.MTIME, CellType.CREATOR, CellType.LAST_MODIFIER, CellType.FILE_NAME, ]; +const TAGS_EDITOR_WIDTH = 400; + class PopupEditorContainer extends React.Component { static displayName = 'PopupEditorContainer'; @@ -23,6 +25,9 @@ class PopupEditorContainer extends React.Component { if (column.type === CellType.SINGLE_SELECT || column.type === CellType.MULTIPLE_SELECT) { additionalStyles = { width, height }; } + if (column.type === CellType.TAGS) { + additionalStyles = { left: left - (TAGS_EDITOR_WIDTH - column.width) }; + } this.state = { isInvalid: false, style: { @@ -82,12 +87,23 @@ class PopupEditorContainer extends React.Component { readOnly, onPressTab, updateFileTags, + showTagsAsTree: true, }; if (column.type === CellType.DATE) { editorProps.format = column?.data?.format; } + if (column.type === CellType.TAGS) { + editorProps = { + ...editorProps, + column: { + ...column, + width: TAGS_EDITOR_WIDTH, + } + }; + } + return (); }; diff --git a/frontend/src/metadata/components/cell-editors/tags-editor/index.js b/frontend/src/metadata/components/cell-editors/tags-editor/index.js index bac50f58c3..7ab204e1a1 100644 --- a/frontend/src/metadata/components/cell-editors/tags-editor/index.js +++ b/frontend/src/metadata/components/cell-editors/tags-editor/index.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import classnames from 'classnames'; import CommonAddTool from '../../../../components/common-add-tool'; import SearchInput from '../../../../components/search-input'; -import DeleteTags from './delete-tags'; import { Utils } from '../../../../utils/utils'; import { KeyCodes } from '../../../../constants'; import { gettext } from '../../../../utils/constants'; @@ -95,17 +94,6 @@ const TagsEditor = forwardRef(({ localStorage.setItem(RECENTLY_USED_TAG_IDS, JSON.stringify(newIds)); }, [value, record, tagsData, updateFileTags, recentlyUsed, localStorage]); - const onDeleteTag = useCallback((tagId) => { - const newValue = value.slice(0); - let optionIdx = value.indexOf(tagId); - if (optionIdx > -1) { - newValue.splice(optionIdx, 1); - } - setValue(newValue); - const recordId = getRecordIdFromRecord(record); - updateFileTags([{ record_id: recordId, tags: newValue, old_tags: value }]); - }, [value, record, updateFileTags]); - const onMenuMouseEnter = useCallback((i, id) => { setHighlightIndex(i); }, []); @@ -306,7 +294,9 @@ const TagsEditor = forwardRef(({ return searchedNodes; }, [tagsData, searchValue, searchedKeyNodeFoldedMap]); - const toggleExpandTreeNode = useCallback((nodeKey) => { + const toggleExpandTreeNode = useCallback((e, nodeKey) => { + e.preventDefault(); + e.stopPropagation(); if (!searchValue) { const updatedKeyNodeFoldedMap = { ...keyNodeFoldedMap }; if (updatedKeyNodeFoldedMap[nodeKey]) { @@ -448,7 +438,7 @@ const TagsEditor = forwardRef(({ depth={getTreeNodeDepth(node)} hasChildren={checkTreeNodeHasChildNodes(node)} isFolded={!searchValue ? keyNodeFoldedMap[nodeKey] : searchedKeyNodeFoldedMap[nodeKey]} - onToggleExpand={() => toggleExpandTreeNode(nodeKey)} + onToggleExpand={(e) => toggleExpandTreeNode(e, nodeKey)} /> ); })} @@ -458,7 +448,6 @@ const TagsEditor = forwardRef(({ return (
-
onSelect(tagId) : () => {}} + onClick={() => onSelect(tagId)} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} > @@ -45,7 +45,7 @@ const TagItem = ({ )} -
onSelect(tagId) : () => {}}> +
{tagName}