mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-27 12:13:53 +00:00
* refactor FileProgress component; pass hideCancelButton, hidePauseResumeButton and hideRetryButton * move icons to where they are rendered, rename UppyIcon to uppy-u-icon * cleanup: rename DashboardItem, remove xmlns * update docs to specify the option also hides action button on each individual file
57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
const Dashboard = require('@uppy/dashboard')
|
|
const has = require('@uppy/utils/lib/hasProperty')
|
|
|
|
const dashboardOptionNames = [
|
|
'metaFields',
|
|
'width',
|
|
'height',
|
|
'thumbnailWidth',
|
|
'showLinkToFileUploadResult',
|
|
'showProgressDetails',
|
|
'hideRetryButton',
|
|
'hideCancelButton',
|
|
'hideUploadButton',
|
|
'hideProgressAfterFinish',
|
|
'note',
|
|
'disableStatusBar',
|
|
'disableInformer',
|
|
'disableThumbnailGenerator',
|
|
'showSelectedFiles',
|
|
'proudlyDisplayPoweredByUppy',
|
|
'theme'
|
|
]
|
|
|
|
const modalDashboardOptionNames = [
|
|
'trigger',
|
|
'closeModalOnClickOutside',
|
|
'closeAfterFinish',
|
|
'disablePageScrollWhenModalOpen',
|
|
'animateOpenClose',
|
|
'onRequestCloseModal',
|
|
'browserBackButtonClose'
|
|
]
|
|
|
|
function addDashboardPlugin (uppy, opts, overrideOpts) {
|
|
const dashboardOpts = {}
|
|
dashboardOptionNames.forEach((key) => {
|
|
if (has(opts, key)) {
|
|
dashboardOpts[key] = opts[key]
|
|
}
|
|
})
|
|
|
|
const inline = overrideOpts.inline == null ? dashboardOpts.inline : overrideOpts.inline
|
|
if (!inline) {
|
|
modalDashboardOptionNames.forEach((key) => {
|
|
if (has(opts, key)) {
|
|
dashboardOpts[key] = opts[key]
|
|
}
|
|
})
|
|
}
|
|
|
|
uppy.use(Dashboard, {
|
|
...dashboardOpts,
|
|
...overrideOpts
|
|
})
|
|
}
|
|
|
|
module.exports = addDashboardPlugin
|