@uppy/progress-bar
Advanced tools
Comparing version 1.3.30 to 2.0.0-alpha.0
@@ -0,16 +1,12 @@ | ||
"use strict"; | ||
var _class, _temp; | ||
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); } | ||
const { | ||
UIPlugin | ||
} = require('@uppy/core'); | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var _require = require('@uppy/core'), | ||
Plugin = _require.Plugin; | ||
var _require2 = require('preact'), | ||
h = _require2.h; | ||
const { | ||
h | ||
} = require('preact'); | ||
/** | ||
@@ -22,14 +18,10 @@ * Progress bar | ||
module.exports = (_temp = _class = /*#__PURE__*/function (_Plugin) { | ||
_inheritsLoose(ProgressBar, _Plugin); | ||
module.exports = (_temp = _class = class ProgressBar extends UIPlugin { | ||
constructor(uppy, opts) { | ||
super(uppy, opts); | ||
this.id = this.opts.id || 'ProgressBar'; | ||
this.title = 'Progress Bar'; | ||
this.type = 'progressindicator'; // set default options | ||
function ProgressBar(uppy, opts) { | ||
var _this; | ||
_this = _Plugin.call(this, uppy, opts) || this; | ||
_this.id = _this.opts.id || 'ProgressBar'; | ||
_this.title = 'Progress Bar'; | ||
_this.type = 'progressindicator'; // set default options | ||
var defaultOptions = { | ||
const defaultOptions = { | ||
target: 'body', | ||
@@ -41,13 +33,12 @@ replaceTargetContent: false, | ||
_this.opts = _extends({}, defaultOptions, opts); | ||
_this.render = _this.render.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
this.opts = { ...defaultOptions, | ||
...opts | ||
}; | ||
this.render = this.render.bind(this); | ||
} | ||
var _proto = ProgressBar.prototype; | ||
render(state) { | ||
const progress = state.totalProgress || 0; // before starting and after finish should be hidden if specified in the options | ||
_proto.render = function render(state) { | ||
var progress = state.totalProgress || 0; // before starting and after finish should be hidden if specified in the options | ||
var isHidden = (progress === 0 || progress === 100) && this.opts.hideAfterFinish; | ||
const isHidden = (progress === 0 || progress === 100) && this.opts.hideAfterFinish; | ||
return h("div", { | ||
@@ -62,3 +53,3 @@ className: "uppy uppy-ProgressBar", | ||
style: { | ||
width: progress + "%" | ||
width: `${progress}%` | ||
} | ||
@@ -68,6 +59,8 @@ }), h("div", { | ||
}, progress)); | ||
}; | ||
} | ||
_proto.install = function install() { | ||
var target = this.opts.target; | ||
install() { | ||
const { | ||
target | ||
} = this.opts; | ||
@@ -77,9 +70,8 @@ if (target) { | ||
} | ||
}; | ||
} | ||
_proto.uninstall = function uninstall() { | ||
uninstall() { | ||
this.unmount(); | ||
}; | ||
} | ||
return ProgressBar; | ||
}(Plugin), _class.VERSION = "1.3.30", _temp); | ||
}, _class.VERSION = "2.0.0-alpha.0", _temp); |
{ | ||
"name": "@uppy/progress-bar", | ||
"description": "A progress bar UI for Uppy", | ||
"version": "1.3.30", | ||
"version": "2.0.0-alpha.0", | ||
"license": "MIT", | ||
@@ -26,4 +26,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^3.6.2", | ||
"preact": "8.2.9" | ||
"@uppy/utils": "^4.0.0-alpha.0", | ||
"preact": "^10.5.13" | ||
}, | ||
@@ -33,3 +33,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "4b782ffbbb443672843d7b4096956bed3b11d612" | ||
"gitHead": "113b627dd0ef5aa5d198dc309dda05da2117dfe5" | ||
} |
@@ -15,4 +15,4 @@ # @uppy/progress-bar | ||
```js | ||
const Uppy = require('@uppy/core') | ||
const ProgressBar = require('@uppy/progress-bar') | ||
import Uppy from '@uppy/core' | ||
import ProgressBar from '@uppy/progress-bar' | ||
@@ -19,0 +19,0 @@ const uppy = new Uppy() |
@@ -1,2 +0,2 @@ | ||
const { Plugin } = require('@uppy/core') | ||
const { UIPlugin } = require('@uppy/core') | ||
const { h } = require('preact') | ||
@@ -8,3 +8,3 @@ | ||
*/ | ||
module.exports = class ProgressBar extends Plugin { | ||
module.exports = class ProgressBar extends UIPlugin { | ||
static VERSION = require('../package.json').version | ||
@@ -49,3 +49,3 @@ | ||
install () { | ||
const target = this.opts.target | ||
const { target } = this.opts | ||
if (target) { | ||
@@ -52,0 +52,0 @@ this.mount(target, this) |
@@ -1,14 +0,12 @@ | ||
import Uppy = require('@uppy/core') | ||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' | ||
declare module ProgressBar { | ||
interface ProgressBarOptions extends Uppy.PluginOptions { | ||
replaceTargetContent?: boolean | ||
target?: Uppy.PluginTarget | ||
hideAfterFinish?: boolean | ||
fixed?: boolean | ||
} | ||
export interface ProgressBarOptions extends PluginOptions { | ||
replaceTargetContent?: boolean | ||
target?: PluginTarget | ||
hideAfterFinish?: boolean | ||
fixed?: boolean | ||
} | ||
declare class ProgressBar extends Uppy.Plugin<ProgressBar.ProgressBarOptions> {} | ||
declare class ProgressBar extends UIPlugin<ProgressBarOptions> {} | ||
export = ProgressBar | ||
export default ProgressBar |
@@ -1,2 +0,12 @@ | ||
import ProgressBar = require('../') | ||
// TODO implement | ||
import Uppy from '@uppy/core' | ||
import ProgressBar from '..' | ||
{ | ||
const uppy = new Uppy() | ||
uppy.use(ProgressBar, { | ||
replaceTargetContent: true, | ||
target: 'body', | ||
hideAfterFinish: true, | ||
fixed: true, | ||
}) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
158
12089
1
+ Added@uppy/utils@4.1.3(transitive)
+ Addedpreact@10.22.0(transitive)
Updated@uppy/utils@^4.0.0-alpha.0
Updatedpreact@^10.5.13