mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 13:50:07 +00:00
Change metadata UI (#6450)
* 01 change select option * 02 fix new column autofocus * 03 fix group by * 04 press enter to create view
This commit is contained in:
@@ -140,7 +140,14 @@ const MetadataTreeView = ({ userPerm, repoID, currentPath, onNodeClick }) => {
|
|||||||
onMove={onMoveView}
|
onMove={onMoveView}
|
||||||
/>);
|
/>);
|
||||||
})}
|
})}
|
||||||
{canAdd && (<CustomizeAddTool className="sf-metadata-add-view" callBack={openAddView} footerName={gettext('Add view')} addIconClassName="sf-metadata-add-view-icon" />)}
|
{canAdd &&
|
||||||
|
<CustomizeAddTool
|
||||||
|
className="sf-metadata-add-view"
|
||||||
|
callBack={openAddView}
|
||||||
|
footerName={gettext('Add view')}
|
||||||
|
addIconClassName="sf-metadata-add-view-icon"
|
||||||
|
/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -55,8 +55,9 @@ const NameDialog = ({ value: oldName, title, onSubmit, onToggle }) => {
|
|||||||
const onHotKey = useCallback((event) => {
|
const onHotKey = useCallback((event) => {
|
||||||
if (event.keyCode === KeyCodes.Enter) {
|
if (event.keyCode === KeyCodes.Enter) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
submit();
|
||||||
}
|
}
|
||||||
}, []);
|
}, [submit]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener('keydown', onHotKey);
|
document.addEventListener('keydown', onHotKey);
|
||||||
|
@@ -22,7 +22,7 @@ const GroupbySetter = ({ columns: allColumns, groupbys: propsGroupbys, wrapperCl
|
|||||||
if (groupbysLength === 1) return gettext('Grouped by 1 column');
|
if (groupbysLength === 1) return gettext('Grouped by 1 column');
|
||||||
if (groupbysLength > 1) return gettext('Grouped by xxx columns').replace('xxx', groupbysLength);
|
if (groupbysLength > 1) return gettext('Grouped by xxx columns').replace('xxx', groupbysLength);
|
||||||
// need to translate to Group
|
// need to translate to Group
|
||||||
return gettext('Group_by');
|
return gettext('Group by');
|
||||||
}, [groupbys]);
|
}, [groupbys]);
|
||||||
|
|
||||||
const onSetterToggle = useCallback(() => {
|
const onSetterToggle = useCallback(() => {
|
||||||
|
@@ -26,7 +26,13 @@ const Name = forwardRef(({ readOnly, value }, ref) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<FormGroup className={classnames('sf-metadata-column-settings-item', { 'is-invalid': error })}>
|
<FormGroup className={classnames('sf-metadata-column-settings-item', { 'is-invalid': error })}>
|
||||||
<Input placeholder={gettext('Column name')} value={name} onChange={onNameChange} readOnly={readOnly} />
|
<Input
|
||||||
|
placeholder={gettext('Column name')}
|
||||||
|
value={name}
|
||||||
|
onChange={onNameChange}
|
||||||
|
readOnly={readOnly}
|
||||||
|
autoFocus={true}
|
||||||
|
/>
|
||||||
{error && (<FormFeedback>{error}</FormFeedback>)}
|
{error && (<FormFeedback>{error}</FormFeedback>)}
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
);
|
);
|
||||||
|
@@ -71,11 +71,12 @@ const OptionsPopover = ({ target, column, onToggle, onSubmit }) => {
|
|||||||
}, [options, displayOptions, onChange]);
|
}, [options, displayOptions, onChange]);
|
||||||
|
|
||||||
const onAdd = useCallback(() => {
|
const onAdd = useCallback(() => {
|
||||||
const newOption = generateNewOption(options, searchValue?.trim() || '');
|
const newOptionName = searchValue?.trim() || '';
|
||||||
|
const newOption = generateNewOption(options, newOptionName);
|
||||||
const newOptions = options.slice(0);
|
const newOptions = options.slice(0);
|
||||||
newOptions.push(newOption);
|
newOptions.push(newOption);
|
||||||
onChange(newOptions);
|
onChange(newOptions);
|
||||||
setEditingOptionId(newOption.id);
|
setEditingOptionId(newOptionName ? '' : newOption.id);
|
||||||
}, [searchValue, options, onChange]);
|
}, [searchValue, options, onChange]);
|
||||||
|
|
||||||
const onDelete = useCallback((optionId) => {
|
const onDelete = useCallback((optionId) => {
|
||||||
|
@@ -58,6 +58,7 @@ const Option = ({
|
|||||||
onDelete: propsDelete, onUpdate,
|
onDelete: propsDelete, onUpdate,
|
||||||
onMouseLeave, onMouseEnter: propsMouseEnter, onToggleFreeze, onOpenNameEditor, onCloseNameEditor,
|
onMouseLeave, onMouseEnter: propsMouseEnter, onToggleFreeze, onOpenNameEditor, onCloseNameEditor,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const onDelete = useCallback((event) => {
|
const onDelete = useCallback((event) => {
|
||||||
event.nativeEvent.stopImmediatePropagation();
|
event.nativeEvent.stopImmediatePropagation();
|
||||||
propsDelete(option.id);
|
propsDelete(option.id);
|
||||||
|
Reference in New Issue
Block a user