@uppy/react
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -1,15 +0,12 @@ | ||
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; }; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var React = require('react'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var DashboardPlugin = require('@uppy/dashboard'); | ||
var React = require('react'); | ||
var DashboardPlugin = require('@uppy/dashboard'); | ||
var basePropTypes = require('./propTypes').dashboard; | ||
var h = React.createElement; | ||
/** | ||
@@ -20,16 +17,18 @@ * React Component that renders a Dashboard for an Uppy instance. This component | ||
var Dashboard = function (_React$Component) { | ||
_inherits(Dashboard, _React$Component); | ||
var Dashboard = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inheritsLoose(Dashboard, _React$Component); | ||
function Dashboard() { | ||
_classCallCheck(this, Dashboard); | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _React$Component.apply(this, arguments) || this; | ||
} | ||
Dashboard.prototype.componentDidMount = function componentDidMount() { | ||
var _proto = Dashboard.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.installPlugin(); | ||
}; | ||
Dashboard.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
if (prevProps.uppy !== this.props.uppy) { | ||
@@ -41,29 +40,35 @@ this.uninstallPlugin(prevProps); | ||
Dashboard.prototype.componentWillUnmount = function componentWillUnmount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this.uninstallPlugin(); | ||
}; | ||
Dashboard.prototype.installPlugin = function installPlugin() { | ||
_proto.installPlugin = function installPlugin() { | ||
var uppy = this.props.uppy; | ||
var options = _extends({ id: 'react:Dashboard' }, this.props, { target: this.container }); | ||
var options = _extends({ | ||
id: 'react:Dashboard' | ||
}, this.props, { | ||
target: this.container | ||
}); | ||
delete options.uppy; | ||
uppy.use(DashboardPlugin, options); | ||
this.plugin = uppy.getPlugin(options.id); | ||
}; | ||
Dashboard.prototype.uninstallPlugin = function uninstallPlugin() { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
_proto.uninstallPlugin = function uninstallPlugin(props) { | ||
if (props === void 0) { | ||
props = this.props; | ||
} | ||
var uppy = props.uppy; | ||
uppy.removePlugin(this.plugin); | ||
}; | ||
Dashboard.prototype.render = function render() { | ||
var _this2 = this; | ||
_proto.render = function render() { | ||
var _this = this; | ||
return h('div', { | ||
ref: function ref(container) { | ||
_this2.container = container; | ||
_this.container = container; | ||
} | ||
@@ -77,7 +82,5 @@ }); | ||
Dashboard.propTypes = basePropTypes; | ||
Dashboard.defaultProps = { | ||
inline: true | ||
}; | ||
module.exports = Dashboard; |
@@ -1,16 +0,14 @@ | ||
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; }; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var React = require('react'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var PropTypes = require('prop-types'); | ||
var React = require('react'); | ||
var PropTypes = require('prop-types'); | ||
var DashboardPlugin = require('@uppy/dashboard'); | ||
var basePropTypes = require('./propTypes').dashboard; | ||
var h = React.createElement; | ||
/** | ||
@@ -21,16 +19,18 @@ * React Component that renders a Dashboard for an Uppy instance in a Modal | ||
var DashboardModal = function (_React$Component) { | ||
_inherits(DashboardModal, _React$Component); | ||
var DashboardModal = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inheritsLoose(DashboardModal, _React$Component); | ||
function DashboardModal() { | ||
_classCallCheck(this, DashboardModal); | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _React$Component.apply(this, arguments) || this; | ||
} | ||
DashboardModal.prototype.componentDidMount = function componentDidMount() { | ||
var _proto = DashboardModal.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.installPlugin(); | ||
}; | ||
DashboardModal.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
if (prevProps.uppy !== this.props.uppy) { | ||
@@ -42,9 +42,12 @@ this.uninstallPlugin(prevProps); | ||
DashboardModal.prototype.componentWillUnmount = function componentWillUnmount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this.uninstallPlugin(); | ||
}; | ||
DashboardModal.prototype.installPlugin = function installPlugin() { | ||
_proto.installPlugin = function installPlugin() { | ||
var uppy = this.props.uppy; | ||
var options = _extends({ id: 'react:DashboardModal' }, this.props, { | ||
var options = _extends({ | ||
id: 'react:DashboardModal' | ||
}, this.props, { | ||
onRequestCloseModal: this.props.onRequestClose | ||
@@ -59,4 +62,4 @@ }); | ||
uppy.use(DashboardPlugin, options); | ||
this.plugin = uppy.getPlugin(options.id); | ||
this.plugin = uppy.getPlugin(options.id); | ||
if (this.props.open) { | ||
@@ -67,11 +70,12 @@ this.plugin.openModal(); | ||
DashboardModal.prototype.uninstallPlugin = function uninstallPlugin() { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
_proto.uninstallPlugin = function uninstallPlugin(props) { | ||
if (props === void 0) { | ||
props = this.props; | ||
} | ||
var uppy = props.uppy; | ||
uppy.removePlugin(this.plugin); | ||
}; | ||
DashboardModal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
if (this.props.open && !nextProps.open) { | ||
@@ -84,8 +88,8 @@ this.plugin.closeModal(); | ||
DashboardModal.prototype.render = function render() { | ||
var _this2 = this; | ||
_proto.render = function render() { | ||
var _this = this; | ||
return h('div', { | ||
ref: function ref(container) { | ||
_this2.container = container; | ||
_this.container = container; | ||
} | ||
@@ -106,5 +110,3 @@ }); | ||
}, basePropTypes); | ||
DashboardModal.defaultProps = {}; | ||
module.exports = DashboardModal; |
@@ -1,15 +0,12 @@ | ||
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; }; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var React = require('react'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var DragDropPlugin = require('@uppy/drag-drop'); | ||
var React = require('react'); | ||
var DragDropPlugin = require('@uppy/drag-drop'); | ||
var propTypes = require('./propTypes'); | ||
var h = React.createElement; | ||
/** | ||
@@ -20,16 +17,18 @@ * React component that renders an area in which files can be dropped to be | ||
var DragDrop = function (_React$Component) { | ||
_inherits(DragDrop, _React$Component); | ||
var DragDrop = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inheritsLoose(DragDrop, _React$Component); | ||
function DragDrop() { | ||
_classCallCheck(this, DragDrop); | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _React$Component.apply(this, arguments) || this; | ||
} | ||
DragDrop.prototype.componentDidMount = function componentDidMount() { | ||
var _proto = DragDrop.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.installPlugin(); | ||
}; | ||
DragDrop.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
if (prevProps.uppy !== this.props.uppy) { | ||
@@ -41,30 +40,35 @@ this.uninstallPlugin(prevProps); | ||
DragDrop.prototype.componentWillUnmount = function componentWillUnmount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this.uninstallPlugin(); | ||
}; | ||
DragDrop.prototype.installPlugin = function installPlugin() { | ||
_proto.installPlugin = function installPlugin() { | ||
var uppy = this.props.uppy; | ||
var options = _extends({ id: 'react:DragDrop' }, this.props, { target: this.container }); | ||
var options = _extends({ | ||
id: 'react:DragDrop' | ||
}, this.props, { | ||
target: this.container | ||
}); | ||
delete options.uppy; | ||
uppy.use(DragDropPlugin, options); | ||
this.plugin = uppy.getPlugin(options.id); | ||
}; | ||
DragDrop.prototype.uninstallPlugin = function uninstallPlugin() { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
_proto.uninstallPlugin = function uninstallPlugin(props) { | ||
if (props === void 0) { | ||
props = this.props; | ||
} | ||
var uppy = props.uppy; | ||
uppy.removePlugin(this.plugin); | ||
}; | ||
DragDrop.prototype.render = function render() { | ||
var _this2 = this; | ||
_proto.render = function render() { | ||
var _this = this; | ||
return h('div', { | ||
ref: function ref(container) { | ||
_this2.container = container; | ||
_this.container = container; | ||
} | ||
@@ -82,3 +86,2 @@ }); | ||
DragDrop.defaultProps = {}; | ||
module.exports = DragDrop; |
@@ -1,16 +0,14 @@ | ||
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; }; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var React = require('react'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var PropTypes = require('prop-types'); | ||
var React = require('react'); | ||
var PropTypes = require('prop-types'); | ||
var ProgressBarPlugin = require('@uppy/progress-bar'); | ||
var uppyPropType = require('./propTypes').uppy; | ||
var h = React.createElement; | ||
/** | ||
@@ -20,16 +18,18 @@ * React component that renders a progress bar at the top of the page. | ||
var ProgressBar = function (_React$Component) { | ||
_inherits(ProgressBar, _React$Component); | ||
var ProgressBar = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inheritsLoose(ProgressBar, _React$Component); | ||
function ProgressBar() { | ||
_classCallCheck(this, ProgressBar); | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _React$Component.apply(this, arguments) || this; | ||
} | ||
ProgressBar.prototype.componentDidMount = function componentDidMount() { | ||
var _proto = ProgressBar.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.installPlugin(); | ||
}; | ||
ProgressBar.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
if (prevProps.uppy !== this.props.uppy) { | ||
@@ -41,30 +41,35 @@ this.uninstallPlugin(prevProps); | ||
ProgressBar.prototype.componentWillUnmount = function componentWillUnmount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this.uninstallPlugin(); | ||
}; | ||
ProgressBar.prototype.installPlugin = function installPlugin() { | ||
_proto.installPlugin = function installPlugin() { | ||
var uppy = this.props.uppy; | ||
var options = _extends({ id: 'react:ProgressBar' }, this.props, { target: this.container }); | ||
var options = _extends({ | ||
id: 'react:ProgressBar' | ||
}, this.props, { | ||
target: this.container | ||
}); | ||
delete options.uppy; | ||
uppy.use(ProgressBarPlugin, options); | ||
this.plugin = uppy.getPlugin(options.id); | ||
}; | ||
ProgressBar.prototype.uninstallPlugin = function uninstallPlugin() { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
_proto.uninstallPlugin = function uninstallPlugin(props) { | ||
if (props === void 0) { | ||
props = this.props; | ||
} | ||
var uppy = props.uppy; | ||
uppy.removePlugin(this.plugin); | ||
}; | ||
ProgressBar.prototype.render = function render() { | ||
var _this2 = this; | ||
_proto.render = function render() { | ||
var _this = this; | ||
return h('div', { | ||
ref: function ref(container) { | ||
_this2.container = container; | ||
_this.container = container; | ||
} | ||
@@ -83,3 +88,2 @@ }); | ||
ProgressBar.defaultProps = {}; | ||
module.exports = ProgressBar; |
var PropTypes = require('prop-types'); | ||
var UppyCore = require('@uppy/core').Uppy; | ||
// The `uppy` prop receives the Uppy core instance. | ||
var uppy = PropTypes.instanceOf(UppyCore).isRequired; | ||
var UppyCore = require('@uppy/core').Uppy; // The `uppy` prop receives the Uppy core instance. | ||
// A list of plugins to mount inside this component. | ||
var plugins = PropTypes.arrayOf(PropTypes.string); | ||
// Language strings for this component. | ||
var uppy = PropTypes.instanceOf(UppyCore).isRequired; // A list of plugins to mount inside this component. | ||
var plugins = PropTypes.arrayOf(PropTypes.string); // Language strings for this component. | ||
var locale = PropTypes.shape({ | ||
strings: PropTypes.object, | ||
pluralize: PropTypes.func | ||
}); | ||
}); // List of meta fields for the editor in the Dashboard. | ||
// List of meta fields for the editor in the Dashboard. | ||
var metaField = PropTypes.shape({ | ||
@@ -22,8 +20,6 @@ id: PropTypes.string.isRequired, | ||
}); | ||
var metaFields = PropTypes.arrayOf(metaField); | ||
var metaFields = PropTypes.arrayOf(metaField); // A size in pixels (number) or with some other unit (string). | ||
// A size in pixels (number) or with some other unit (string). | ||
var cssSize = PropTypes.oneOfType([PropTypes.string, PropTypes.number]); | ||
var cssSize = PropTypes.oneOfType([PropTypes.string, PropTypes.number]); // Common props for dashboardy components (Dashboard and DashboardModal). | ||
// Common props for dashboardy components (Dashboard and DashboardModal). | ||
var dashboard = { | ||
@@ -48,3 +44,2 @@ uppy: uppy, | ||
}; | ||
module.exports = { | ||
@@ -51,0 +46,0 @@ uppy: uppy, |
@@ -1,16 +0,14 @@ | ||
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; }; | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var React = require('react'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var PropTypes = require('prop-types'); | ||
var React = require('react'); | ||
var PropTypes = require('prop-types'); | ||
var StatusBarPlugin = require('@uppy/status-bar'); | ||
var uppyPropType = require('./propTypes').uppy; | ||
var h = React.createElement; | ||
/** | ||
@@ -21,16 +19,18 @@ * React component that renders a status bar containing upload progress and speed, | ||
var StatusBar = function (_React$Component) { | ||
_inherits(StatusBar, _React$Component); | ||
var StatusBar = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inheritsLoose(StatusBar, _React$Component); | ||
function StatusBar() { | ||
_classCallCheck(this, StatusBar); | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _React$Component.apply(this, arguments) || this; | ||
} | ||
StatusBar.prototype.componentDidMount = function componentDidMount() { | ||
var _proto = StatusBar.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.installPlugin(); | ||
}; | ||
StatusBar.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
if (prevProps.uppy !== this.props.uppy) { | ||
@@ -42,30 +42,35 @@ this.uninstallPlugin(prevProps); | ||
StatusBar.prototype.componentWillUnmount = function componentWillUnmount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this.uninstallPlugin(); | ||
}; | ||
StatusBar.prototype.installPlugin = function installPlugin() { | ||
_proto.installPlugin = function installPlugin() { | ||
var uppy = this.props.uppy; | ||
var options = _extends({ id: 'react:StatusBar' }, this.props, { target: this.container }); | ||
var options = _extends({ | ||
id: 'react:StatusBar' | ||
}, this.props, { | ||
target: this.container | ||
}); | ||
delete options.uppy; | ||
uppy.use(StatusBarPlugin, options); | ||
this.plugin = uppy.getPlugin(options.id); | ||
}; | ||
StatusBar.prototype.uninstallPlugin = function uninstallPlugin() { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
_proto.uninstallPlugin = function uninstallPlugin(props) { | ||
if (props === void 0) { | ||
props = this.props; | ||
} | ||
var uppy = props.uppy; | ||
uppy.removePlugin(this.plugin); | ||
}; | ||
StatusBar.prototype.render = function render() { | ||
var _this2 = this; | ||
_proto.render = function render() { | ||
var _this = this; | ||
return h('div', { | ||
ref: function ref(container) { | ||
_this2.container = container; | ||
_this.container = container; | ||
} | ||
@@ -84,3 +89,2 @@ }); | ||
StatusBar.defaultProps = {}; | ||
module.exports = StatusBar; |
@@ -1,9 +0,9 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var React = require('react'); | ||
var React = require('react'); | ||
var PropTypes = require('prop-types'); | ||
var uppyPropType = require('./propTypes').uppy; | ||
@@ -13,19 +13,22 @@ | ||
var UppyWrapper = function (_React$Component) { | ||
_inherits(UppyWrapper, _React$Component); | ||
var UppyWrapper = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inheritsLoose(UppyWrapper, _React$Component); | ||
function UppyWrapper(props) { | ||
_classCallCheck(this, UppyWrapper); | ||
var _this; | ||
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); | ||
_this.refContainer = _this.refContainer.bind(_this); | ||
_this = _React$Component.call(this, props) || this; | ||
_this.refContainer = _this.refContainer.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
} | ||
UppyWrapper.prototype.componentDidMount = function componentDidMount() { | ||
var _proto = UppyWrapper.prototype; | ||
_proto.componentDidMount = function componentDidMount() { | ||
this.installPlugin(); | ||
}; | ||
UppyWrapper.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
if (prevProps.uppy !== this.props.uppy) { | ||
@@ -37,26 +40,28 @@ this.uninstallPlugin(prevProps); | ||
UppyWrapper.prototype.componentWillUnmount = function componentWillUnmount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this.uninstallPlugin(); | ||
}; | ||
UppyWrapper.prototype.installPlugin = function installPlugin() { | ||
_proto.installPlugin = function installPlugin() { | ||
var plugin = this.props.uppy.getPlugin(this.props.plugin); | ||
plugin.mount(this.container, plugin); | ||
}; | ||
UppyWrapper.prototype.uninstallPlugin = function uninstallPlugin() { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; | ||
_proto.uninstallPlugin = function uninstallPlugin(props) { | ||
if (props === void 0) { | ||
props = this.props; | ||
} | ||
var plugin = props.uppy.getPlugin(this.props.plugin); | ||
plugin.unmount(); | ||
}; | ||
UppyWrapper.prototype.refContainer = function refContainer(container) { | ||
_proto.refContainer = function refContainer(container) { | ||
this.container = container; | ||
}; | ||
UppyWrapper.prototype.render = function render() { | ||
return h('div', { ref: this.refContainer }); | ||
_proto.render = function render() { | ||
return h('div', { | ||
ref: this.refContainer | ||
}); | ||
}; | ||
@@ -71,3 +76,2 @@ | ||
}; | ||
module.exports = UppyWrapper; |
{ | ||
"name": "@uppy/react", | ||
"description": "React component wrappers around Uppy's official UI plugins.", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -25,11 +25,11 @@ "main": "index.js", | ||
"dependencies": { | ||
"@uppy/dashboard": "1.0.2", | ||
"@uppy/drag-drop": "1.0.2", | ||
"@uppy/progress-bar": "1.0.2", | ||
"@uppy/status-bar": "1.0.2", | ||
"@uppy/utils": "1.0.2", | ||
"@uppy/dashboard": "1.1.0", | ||
"@uppy/drag-drop": "1.1.0", | ||
"@uppy/progress-bar": "1.1.0", | ||
"@uppy/status-bar": "1.1.0", | ||
"@uppy/utils": "1.1.0", | ||
"prop-types": "^15.6.1" | ||
}, | ||
"devDependencies": { | ||
"@uppy/core": "1.0.2" | ||
"@uppy/core": "1.1.0" | ||
}, | ||
@@ -39,3 +39,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5c9e1a836df858254657a59ab8bd4b90035cf8b4" | ||
"gitHead": "28d235fe2fb57d87a399c20883fd6590aa49f4f4" | ||
} |
@@ -16,7 +16,10 @@ import { Uppy, Locale } from './CommonTypes'; | ||
height?: number; | ||
showLinkToFileUploadResult?: boolean; | ||
showProgressDetails?: boolean; | ||
showLinkToFileUploadResult?: boolean; | ||
showSelectedFiles?: boolean; | ||
hideUploadButton?: boolean; | ||
hideRetryButton?: boolean; | ||
hidePauseResumeButton?: boolean; | ||
hideCancelButton?: boolean; | ||
hideProgressAfterFinish?: boolean; | ||
showSelectedFiles?: boolean; | ||
note?: string; | ||
@@ -23,0 +26,0 @@ metaFields?: Array<MetaField>; |
@@ -7,2 +7,4 @@ import { DashboardProps } from './Dashboard'; | ||
onRequestClose?: VoidFunction; | ||
closeAfterFinish?: boolean; | ||
animateOpenClose?: boolean; | ||
closeModalOnClickOutside?: boolean; | ||
@@ -9,0 +11,0 @@ disablePageScrollWhenModalOpen?: boolean; |
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
1135
39600
+ Added@uppy/dashboard@1.1.0(transitive)
+ Added@uppy/drag-drop@1.1.0(transitive)
+ Added@uppy/informer@1.1.0(transitive)
+ Added@uppy/progress-bar@1.1.0(transitive)
+ Added@uppy/provider-views@1.1.0(transitive)
+ Added@uppy/status-bar@1.1.0(transitive)
+ Added@uppy/thumbnail-generator@1.1.0(transitive)
+ Added@uppy/utils@1.1.0(transitive)
- Removed@uppy/dashboard@1.0.2(transitive)
- Removed@uppy/drag-drop@1.0.2(transitive)
- Removed@uppy/informer@1.0.2(transitive)
- Removed@uppy/progress-bar@1.0.2(transitive)
- Removed@uppy/provider-views@1.0.2(transitive)
- Removed@uppy/status-bar@1.0.2(transitive)
- Removed@uppy/thumbnail-generator@1.0.2(transitive)
- Removed@uppy/utils@1.0.2(transitive)
- Removedblob-to-buffer@1.2.9(transitive)
- Removeddrag-drop@2.13.3(transitive)
- Removedflatten@1.0.3(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedrun-parallel@1.2.0(transitive)
Updated@uppy/dashboard@1.1.0
Updated@uppy/drag-drop@1.1.0
Updated@uppy/progress-bar@1.1.0
Updated@uppy/status-bar@1.1.0
Updated@uppy/utils@1.1.0