uppy/packages/@uppy/robodog/src/addDashboardPlugin.js
Kevin van Zonneveld 764c2ccada
Update Linter (#2796)
* relocate .vscode

* Switch to transloadit linter

* Update .eslintrc.json

* autofix code

* unlink and install eslint-config-transloadit@1.1.1

* Change 0 to "off"

* Don't change 'use strict'

* Do not vertically align

* disable key-spacing

* add import/no-extraneous-dependencies per package

* add more react/a11y warnings

* Revert "autofix code"

This reverts commit 14c8a8cde8.

* add import/no-extraneous-dependencies per example and main package

* autofix code (2)

* Allow devDependencies in ./bin

* Change import/no-extraneous-dependencies to warn again

* upgrade linter

* Set import/no-extraneous-dependencies to warn
2021-03-15 16:25:17 +00:00

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