-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add kanban view * optimize code * update setting panel and favicon * fix drag and drop bug * update empty tips * add card placeholder * update card drag and drop * update list drag and drop * optimize code * fix drop bug * fix syntax error * feat: optimize code * feat: add op * feat: optimize ui * format code * feat: optimize ui * feat: optimize code * optimize code --------- Co-authored-by: zhouwenxuan <[email protected]> Co-authored-by: 杨国璇 <[email protected]>
- Loading branch information
1 parent
51cfcee
commit 89760c7
Showing
55 changed files
with
3,937 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
frontend/src/metadata/components/popover/kanban-add-category-popover/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.sf-metadata-kanban-add-board-popover .popover { | ||
width: 360px; | ||
max-width: none; | ||
padding: 1rem 0 0; | ||
} | ||
|
||
.sf-metadata-kanban-add-board-popover .kanban-popover-body { | ||
display: flex; | ||
align-items: center; | ||
padding: 0 1rem; | ||
} | ||
|
||
.sf-metadata-kanban-add-board-popover .kanban-popover-footer { | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-end; | ||
padding: 1rem; | ||
} |
83 changes: 83 additions & 0 deletions
83
frontend/src/metadata/components/popover/kanban-add-category-popover/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React, { useState, useCallback } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button } from 'reactstrap'; | ||
import { CustomizePopover } from '@seafile/sf-metadata-ui-component'; | ||
import Color from '../options-popover/option/color'; | ||
import Name from '../options-popover/option/name'; | ||
import { generateNewOption } from '../../../utils/column'; | ||
import { gettext } from '../../../../utils/constants'; | ||
import { COLUMN_DATA_OPERATION_TYPE } from '../../../store/operations'; | ||
import toaster from '../../../../components/toast'; | ||
|
||
import './index.css'; | ||
|
||
const KanbanAddCategoryPopover = ({ target, options, onCancel, onSubmit }) => { | ||
const [option, setOption] = useState(generateNewOption(options, '')); | ||
|
||
const handleOptionChange = useCallback((newOption, type) => { | ||
switch (type) { | ||
case COLUMN_DATA_OPERATION_TYPE.MODIFY_OPTION_COLOR: | ||
setOption({ ...option, color: newOption.color, textColor: newOption.textColor, borderColor: newOption.borderColor }); | ||
break; | ||
case COLUMN_DATA_OPERATION_TYPE.RENAME_OPTION: | ||
setOption({ ...option, name: newOption.name }); | ||
break; | ||
default: | ||
break; | ||
} | ||
}, [option]); | ||
|
||
const handleSubmit = useCallback(() => { | ||
if (!option.name) { | ||
toaster.danger(gettext('Name is required')); | ||
return; | ||
} | ||
|
||
const duplicateNameOption = options.find(o => o.name === option.name && o.id !== option.id); | ||
if (duplicateNameOption) { | ||
toaster.danger(gettext('There is another option with this name')); | ||
return; | ||
} | ||
|
||
onSubmit(option); | ||
}, [options, option, onSubmit]); | ||
|
||
return ( | ||
<CustomizePopover | ||
target={target} | ||
className="sf-metadata-kanban-add-board-popover" | ||
hide={onCancel} | ||
hideWithEsc={onCancel} | ||
modifiers={{ preventOverflow: { boundariesElement: document.body } }} | ||
> | ||
<div className="sf-metadata-kanban-add-board-popover-inner"> | ||
<div className="kanban-popover-body"> | ||
<Color | ||
option={option} | ||
onChange={handleOptionChange} | ||
isViewing={true} | ||
isPredefined={false} | ||
/> | ||
<Name | ||
option={option} | ||
isEditing={true} | ||
onChange={handleOptionChange} | ||
/> | ||
</div> | ||
<div className="kanban-popover-footer"> | ||
<Button className="mr-2" onClick={onCancel}>{gettext('Cancel')}</Button> | ||
<Button color="primary" onClick={handleSubmit}>{gettext('Submit')}</Button> | ||
</div> | ||
</div> | ||
</CustomizePopover> | ||
); | ||
}; | ||
|
||
KanbanAddCategoryPopover.propTypes = { | ||
target: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), | ||
options: PropTypes.array.isRequired, | ||
onCancel: PropTypes.func.isRequired, | ||
onSubmit: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default KanbanAddCategoryPopover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useCallback } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { SeahubSelect } from '../../components/common/select'; | ||
|
||
const Selector = ({ options, settingKey, value, defaultValue, onChange }) => { | ||
|
||
const handelOnChange = useCallback((option) => { | ||
const newValue = option.value; | ||
if (newValue === value) return; | ||
onChange(settingKey, newValue); | ||
}, [settingKey, value, onChange]); | ||
|
||
let selectedOption = options.find(option => option.value === value); | ||
if (!selectedOption && defaultValue) { | ||
options.find(option => option.value === defaultValue); | ||
} | ||
|
||
return ( | ||
<SeahubSelect | ||
classNamePrefix="sf-metadata-setting-selector" | ||
value={selectedOption} | ||
options={options} | ||
onChange={handelOnChange} | ||
menuPortalTarget="sf-metadata-view-setting-panel" | ||
/> | ||
); | ||
}; | ||
|
||
Selector.propTypes = { | ||
settingKey: PropTypes.string, | ||
value: PropTypes.string, | ||
options: PropTypes.array.isRequired, | ||
onChange: PropTypes.func, | ||
}; | ||
|
||
export default Selector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
frontend/src/metadata/components/view-toolbar/kanban-view-toolbar/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React, { useMemo } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { IconBtn } from '@seafile/sf-metadata-ui-component'; | ||
import { EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../../constants'; | ||
import { FilterSetter, SortSetter } from '../../data-process-setter'; | ||
|
||
const KanbanViewToolBar = ({ | ||
readOnly, | ||
view, | ||
collaborators, | ||
modifyFilters, | ||
modifySorts | ||
}) => { | ||
const viewType = useMemo(() => view.type, [view]); | ||
const viewColumns = useMemo(() => { | ||
if (!view) return []; | ||
return view.columns; | ||
}, [view]); | ||
|
||
const filterColumns = useMemo(() => { | ||
return viewColumns.filter(c => c.key !== PRIVATE_COLUMN_KEY.FILE_TYPE); | ||
}, [viewColumns]); | ||
|
||
const onToggleKanbanSetting = () => { | ||
window.sfMetadataContext.eventBus.dispatch(EVENT_BUS_TYPE.TOGGLE_KANBAN_SETTINGS); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="sf-metadata-tool-left-operations"> | ||
<FilterSetter | ||
isNeedSubmit={true} | ||
wrapperClass="sf-metadata-view-tool-operation-btn sf-metadata-view-tool-filter" | ||
filtersClassName="sf-metadata-filters" | ||
target="sf-metadata-filter-popover" | ||
readOnly={readOnly} | ||
filterConjunction={view.filter_conjunction} | ||
basicFilters={view.basic_filters} | ||
filters={view.filters} | ||
columns={filterColumns} | ||
modifyFilters={modifyFilters} | ||
collaborators={collaborators} | ||
viewType={viewType} | ||
/> | ||
<SortSetter | ||
isNeedSubmit={true} | ||
wrapperClass="sf-metadata-view-tool-operation-btn sf-metadata-view-tool-sort" | ||
target="sf-metadata-sort-popover" | ||
readOnly={readOnly} | ||
sorts={view.sorts} | ||
type={viewType} | ||
columns={viewColumns} | ||
modifySorts={modifySorts} | ||
/> | ||
<IconBtn | ||
iconName="set-up" | ||
className="sf-metadata-view-tool-operation-btn sf-metadata-view-tool-setting" | ||
size={24} | ||
role="button" | ||
aria-label="Setting" | ||
tabIndex={0} | ||
onClick={onToggleKanbanSetting} | ||
/> | ||
</div> | ||
<div className="sf-metadata-tool-right-operations"></div> | ||
</> | ||
); | ||
}; | ||
|
||
KanbanViewToolBar.propTypes = { | ||
readOnly: PropTypes.bool, | ||
view: PropTypes.object, | ||
collaborators: PropTypes.array, | ||
modifyFilters: PropTypes.func, | ||
modifySorts: PropTypes.func | ||
}; | ||
|
||
export default KanbanViewToolBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,3 +133,5 @@ export const GALLERY_DATE_MODE = { | |
DAY: 'day', | ||
ALL: 'all', | ||
}; | ||
|
||
export const UNCATEGORIZED = '_uncategorized'; |
Oops, something went wrong.