@uppy/dashboard
Advanced tools
Comparing version 0.29.1 to 0.30.0
@@ -20,2 +20,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var toArray = require('@uppy/utils/lib/toArray'); | ||
var cuid = require('cuid'); | ||
// const prettyBytes = require('prettier-bytes') | ||
@@ -37,2 +38,11 @@ var ResizeObserver = require('resize-observer-polyfill').default || require('resize-observer-polyfill'); | ||
function createPromise() { | ||
var o = {}; | ||
o.promise = new Promise(function (resolve, reject) { | ||
o.resolve = resolve; | ||
o.reject = reject; | ||
}); | ||
return o; | ||
} | ||
/** | ||
@@ -52,3 +62,3 @@ * Dashboard UI with previews, metadata editing, tabs for various services and more | ||
_this.type = 'orchestrator'; | ||
_this.modalName = 'uppy-Dashboard'; | ||
_this.modalName = 'uppy-Dashboard-' + cuid(); | ||
@@ -272,6 +282,6 @@ var defaultLocale = { | ||
if (!history.state || !history.state[this.modalName]) { | ||
var _history$pushState; | ||
var _extends2; | ||
// Push to history so that the page is not lost on browser back button press | ||
history.pushState((_history$pushState = {}, _history$pushState[this.modalName] = true, _history$pushState), ''); | ||
history.pushState(_extends({}, history.state, (_extends2 = {}, _extends2[this.modalName] = true, _extends2)), ''); | ||
} | ||
@@ -285,3 +295,3 @@ | ||
// Close the modal if the history state no longer contains our modal name | ||
if (!event.state || !event.state[this.modalName]) { | ||
if (this.isModalOpen() && (!event.state || !event.state[this.modalName])) { | ||
this.closeModal({ manualClose: false }); | ||
@@ -321,3 +331,8 @@ } | ||
var _createPromise = createPromise(), | ||
promise = _createPromise.promise, | ||
resolve = _createPromise.resolve; | ||
// save scroll position | ||
this.savedScrollPosition = window.scrollY; | ||
@@ -337,2 +352,3 @@ // save active element, so we can restore focus when modal is closed | ||
_this2.el.removeEventListener('animationend', handler, false); | ||
resolve(); | ||
}; | ||
@@ -344,2 +360,3 @@ this.el.addEventListener('animationend', handler, false); | ||
}); | ||
resolve(); | ||
} | ||
@@ -356,2 +373,4 @@ | ||
this.setFocusToBrowse(); | ||
return promise; | ||
}; | ||
@@ -366,3 +385,15 @@ | ||
var _getPluginState2 = this.getPluginState(), | ||
isHidden = _getPluginState2.isHidden, | ||
isClosing = _getPluginState2.isClosing; | ||
if (isHidden || isClosing) { | ||
// short-circuit if animation is ongoing | ||
return; | ||
} | ||
var _createPromise2 = createPromise(), | ||
promise = _createPromise2.promise, | ||
resolve = _createPromise2.resolve; | ||
if (this.opts.disablePageScrollWhenModalOpen) { | ||
@@ -382,2 +413,3 @@ document.body.classList.remove('uppy-Dashboard-isFixed'); | ||
_this3.el.removeEventListener('animationend', handler, false); | ||
resolve(); | ||
}; | ||
@@ -389,2 +421,3 @@ this.el.addEventListener('animationend', handler, false); | ||
}); | ||
resolve(); | ||
} | ||
@@ -406,2 +439,4 @@ | ||
} | ||
return promise; | ||
}; | ||
@@ -408,0 +443,0 @@ |
{ | ||
"name": "@uppy/dashboard", | ||
"description": "Universal UI plugin for Uppy.", | ||
"version": "0.29.1", | ||
"version": "0.30.0", | ||
"license": "MIT", | ||
@@ -25,8 +25,9 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/informer": "0.29.1", | ||
"@uppy/provider-views": "0.29.1", | ||
"@uppy/status-bar": "0.29.1", | ||
"@uppy/thumbnail-generator": "0.29.1", | ||
"@uppy/utils": "0.29.1", | ||
"@uppy/informer": "0.30.0", | ||
"@uppy/provider-views": "0.30.0", | ||
"@uppy/status-bar": "0.30.0", | ||
"@uppy/thumbnail-generator": "0.30.0", | ||
"@uppy/utils": "0.30.0", | ||
"classnames": "^2.2.6", | ||
"cuid": "^2.1.1", | ||
"drag-drop": "2.13.3", | ||
@@ -40,9 +41,9 @@ "lodash.throttle": "^4.1.1", | ||
"devDependencies": { | ||
"@uppy/core": "0.29.1", | ||
"@uppy/google-drive": "0.29.1" | ||
"@uppy/core": "0.30.0", | ||
"@uppy/google-drive": "0.30.0" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^0.29.0" | ||
"@uppy/core": "^0.30.0" | ||
}, | ||
"gitHead": "3ddf4c7548766a0c522b9a45c03b1fd7d4e03d43" | ||
"gitHead": "4dcef4c3b949a35ccfe7b4339a776a5d43052664" | ||
} |
@@ -10,2 +10,3 @@ const { Plugin } = require('@uppy/core') | ||
const toArray = require('@uppy/utils/lib/toArray') | ||
const cuid = require('cuid') | ||
// const prettyBytes = require('prettier-bytes') | ||
@@ -35,2 +36,11 @@ const ResizeObserver = require('resize-observer-polyfill').default || require('resize-observer-polyfill') | ||
function createPromise () { | ||
const o = {} | ||
o.promise = new Promise((resolve, reject) => { | ||
o.resolve = resolve | ||
o.reject = reject | ||
}) | ||
return o | ||
} | ||
/** | ||
@@ -45,3 +55,3 @@ * Dashboard UI with previews, metadata editing, tabs for various services and more | ||
this.type = 'orchestrator' | ||
this.modalName = 'uppy-Dashboard' | ||
this.modalName = `uppy-Dashboard-${cuid()}` | ||
@@ -146,3 +156,3 @@ const defaultLocale = { | ||
// merge default options with the ones set by user | ||
this.opts = Object.assign({}, defaultOptions, opts) | ||
this.opts = { ...defaultOptions, ...opts } | ||
@@ -263,3 +273,6 @@ // i18n | ||
// Push to history so that the page is not lost on browser back button press | ||
history.pushState({ [this.modalName]: true }, '') | ||
history.pushState({ | ||
...history.state, | ||
[this.modalName]: true | ||
}, '') | ||
} | ||
@@ -273,3 +286,3 @@ | ||
// Close the modal if the history state no longer contains our modal name | ||
if (!event.state || !event.state[this.modalName]) { | ||
if (this.isModalOpen() && (!event.state || !event.state[this.modalName])) { | ||
this.closeModal({ manualClose: false }) | ||
@@ -307,2 +320,3 @@ } | ||
openModal () { | ||
const { promise, resolve } = createPromise() | ||
// save scroll position | ||
@@ -323,2 +337,3 @@ this.savedScrollPosition = window.scrollY | ||
this.el.removeEventListener('animationend', handler, false) | ||
resolve() | ||
} | ||
@@ -330,2 +345,3 @@ this.el.addEventListener('animationend', handler, false) | ||
}) | ||
resolve() | ||
} | ||
@@ -342,2 +358,4 @@ | ||
this.setFocusToBrowse() | ||
return promise | ||
} | ||
@@ -350,2 +368,10 @@ | ||
const { isHidden, isClosing } = this.getPluginState() | ||
if (isHidden || isClosing) { | ||
// short-circuit if animation is ongoing | ||
return | ||
} | ||
const { promise, resolve } = createPromise() | ||
if (this.opts.disablePageScrollWhenModalOpen) { | ||
@@ -365,2 +391,3 @@ document.body.classList.remove('uppy-Dashboard-isFixed') | ||
this.el.removeEventListener('animationend', handler, false) | ||
resolve() | ||
} | ||
@@ -372,2 +399,3 @@ this.el.addEventListener('animationend', handler, false) | ||
}) | ||
resolve() | ||
} | ||
@@ -389,2 +417,4 @@ | ||
} | ||
return promise | ||
} | ||
@@ -391,0 +421,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
291597
5412
14
+ Addedcuid@^2.1.1
+ Added@uppy/core@0.30.5(transitive)
+ Added@uppy/informer@0.30.0(transitive)
+ Added@uppy/provider-views@0.30.0(transitive)
+ Added@uppy/status-bar@0.30.0(transitive)
+ Added@uppy/store-default@0.28.3(transitive)
+ Added@uppy/thumbnail-generator@0.30.0(transitive)
+ Added@uppy/utils@0.30.00.30.5(transitive)
- Removed@uppy/core@0.29.1(transitive)
- Removed@uppy/informer@0.29.1(transitive)
- Removed@uppy/provider-views@0.29.1(transitive)
- Removed@uppy/status-bar@0.29.1(transitive)
- Removed@uppy/store-default@0.27.1(transitive)
- Removed@uppy/thumbnail-generator@0.29.1(transitive)
- Removed@uppy/utils@0.29.1(transitive)
Updated@uppy/informer@0.30.0
Updated@uppy/provider-views@0.30.0
Updated@uppy/status-bar@0.30.0
Updated@uppy/utils@0.30.0