1234567891011121314151617181920212223242526272829303132333435363738 |
- import Plugin from './Plugin'
- import yo from 'yo-yo'
- /**
- * Progress bar
- *
- */
- export default class ProgressBar extends Plugin {
- constructor (core, opts) {
- super(core, opts)
- this.id = 'ProgressBar'
- this.title = 'Progress Bar'
- this.type = 'progressindicator'
- // set default options
- const defaultOptions = {
- replaceTargetContent: false
- }
- // merge default options with the ones set by user
- this.opts = Object.assign({}, defaultOptions, opts)
- }
- render (state) {
- const progress = state.totalProgress || 0
- return yo`<div class="UppyProgressBar">
- <div class="UppyProgressBar-inner" style="width: ${progress}%"></div>
- <div class="UppyProgressBar-percentage">${progress}</div>
- </div>`
- }
- install () {
- const target = this.opts.target
- const plugin = this
- this.target = this.mount(target, plugin)
- }
- }
|