-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhouwenxuan
authored and
zhouwenxuan
committed
Oct 29, 2024
1 parent
55d9cdf
commit 6c4f344
Showing
12 changed files
with
383 additions
and
24 deletions.
There are no files selected for viewing
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
79 changes: 67 additions & 12 deletions
79
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 |
---|---|---|
@@ -1,24 +1,79 @@ | ||
import React from 'react'; | ||
import React, { useMemo } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { IconBtn } from '@seafile/sf-metadata-ui-component'; | ||
import { EVENT_BUS_TYPE } from '../../../constants'; | ||
import { EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../../constants'; | ||
import { FilterSetter, SortSetter } from '../../data-process-setter'; | ||
|
||
const KanbanViewToolBar = () => { | ||
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_SETTING); | ||
}; | ||
|
||
return ( | ||
<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 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
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
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
Oops, something went wrong.