Commit graph

1198 commits

Author SHA1 Message Date
Renée Kooi
d330c26813
react: Different way to do React components
This is a different approach to React components suggested by @arturi.
Instead of the components adding and removing plugins when mounting and
unmounting, plugins are configured at the start, and the components act
as slots for the plugins to actually mount in. Because all plugins are
still being configured up front here, we don't have to change how the
provider `target:` options work, they can install themselves into eg.
the Dashboard plugin immediately.

The core of this approach is the `UppyWrapper` component, which takes an
Uppy instance and a plugin ID, and mounts the plugin inside itself. The
other components only provide a default plugin ID.

The one change required in Uppy itself for this to work is to the
`mount()` functions: now, `mount()` configures `this.target` on the
plugins. If plugins do not have a `target:` option, they do not mount on
install. Some DOM code also had to be moved into the `mount()` function
for the DragDrop component instead of staying in `install()`, but I
think it makes sense.

(Still have to work out how to make the `DashboardModal` component's
`onRequestClose` option work.)
2017-09-18 14:40:32 +02:00
Renée Kooi
92cf9ab8f9
plugin: remove .focus() 2017-09-18 14:40:32 +02:00
Renée Kooi
eae8512531
dashboard: uninstall internal StatusBar and Informer plugins on remove 2017-09-18 14:40:31 +02:00
Renée Kooi
bd506d8425
dashboard: auto-discover previously added provider plugins 2017-09-18 14:40:31 +02:00
Renée Kooi
9174abf855
core: make mount()ing an unknown plugin a noop 2017-09-18 14:40:31 +02:00
Renée Kooi
36365b90f9
core: Avoid instantiating target plugin in mount(). 2017-09-18 14:40:31 +02:00
Renée Kooi
abeb01882a
react: Pass through component props to plugin options 2017-09-18 14:40:31 +02:00
Renée Kooi
5c842703ce
Implement onRequestClose in main Dashboard plugin. 2017-09-18 14:40:30 +02:00
Renée Kooi
3c0609c0d4
react: Fix proptype failures 2017-09-18 14:40:30 +02:00
Renée Kooi
57f33b08dd
react: Fix duplicate Informer and StatusBar in DashboardModal component 2017-09-18 14:40:30 +02:00
Renée Kooi
c465155186
react: Use prop-types package. 2017-09-18 14:40:30 +02:00
Renée Kooi
ae0037d87e
react: implement unmounting better in Dashboard 2017-09-18 14:40:30 +02:00
Renée Kooi
bae5e63be1
dashboard: support mounting StatusBar and Informer on subclasses 2017-09-18 14:40:29 +02:00
René Kooi
191c7f6b1e
uppy-react: Add <ProgressBar /> component. 2017-09-18 14:40:29 +02:00
René Kooi
4e74a1ac19
uppy-react: Experiment with unmounting.
This implements unmounting for the inline Dashboard component.
To do that, the Dashboard plugin now has a method `uninstall`,
which removes all listeners and removes the Dashboard element
from the DOM. The `componentWillUnmount` handler removes the plugin
from Uppy's internal plugin list. If this approach is the way to
go, we'd add a method to core to remove plugins… I think in that
case, it'd be good to add some concept of View Plugins, so that
Acquirer plugins function like they do now but View plugins can be
mounted and unmounted.
2017-09-18 14:40:29 +02:00
René Kooi
9828733fb2
uppy-react: Add locale props to all components. 2017-09-18 14:37:42 +02:00
René Kooi
24059a1851
uppy-react: Add most Dashboard plugin options as props. 2017-09-18 14:37:41 +02:00
René Kooi
812f60e7fe
uppy-react: Add a DragDrop component wrapper. 2017-09-18 14:37:41 +02:00
René Kooi
82960df150
uppy-react: Add some semi jsdoc to Dashboard components. 2017-09-18 14:37:41 +02:00
René Kooi
05804c8e7e
Only apply Dashboard modal z-indexes in modal mode.
If the dashboard is used in inline mode, the z-indexes are not
necessary, and may even interfere. This is visible in the React
demo, where the inline dashboard would appear on top of the overlay
of the modal dashboard, instead of behind it.
2017-09-18 14:37:41 +02:00
René Kooi
f962fb4c14
uppy-react: Add initial React Dashboard component. 2017-09-18 14:37:41 +02:00
Artur Paikin
a4668d4f96 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/core/Core.js
#	src/plugins/Dashboard/index.js
2017-09-15 23:56:18 -04:00
Artur Paikin
7b7aa7d7d9 add type.mime to tests 2017-09-14 22:50:14 -04:00
Artur Paikin
4a85a4d1e0 refactor a little, add file.type.mime (before the migration to mime entirely) add comments 2017-09-14 22:39:21 -04:00
Artur Paikin
1f8a369f4f separate checkMinNumberOfFiles method 2017-09-14 13:20:45 -04:00
Artur Paikin
829713851e Adjust checkMinNumberOfFiles
Fixes #344
2017-09-14 12:51:19 -04:00
Artur Paikin
4e808ca3d2 add aria-hidden to all icons for accessibility, remove console.log 2017-09-14 12:01:19 -04:00
Artur Paikin
0eb2448a3d Fix calculateTotalProgress - NaN 2017-09-13 18:50:41 -04:00
Artur Paikin
016557e246 Merge pull request #330 from transloadit/fix/fileID
Better `generateFileID`
2017-09-12 11:10:29 -04:00
Artur Paikin
0e1a4b51a4 Merge pull request #335 from richardwillars/core-tests
[WIP] Remaining tests for src/core.js
2017-09-12 11:09:16 -04:00
Artur Paikin
e69151ca0c Merge pull request #319 from richardwillars/isOnline
Tell Uppy to be offline
2017-09-12 10:59:20 -04:00
Richard Willars
050ecbfa1e Adds tests for checkRestrictions 2017-09-12 15:48:03 +01:00
Richard Willars
abbaed88cd Test for createUpload 2017-09-12 10:50:12 +01:00
Richard Willars
979be04540 Remove upload test 2017-09-12 10:10:21 +01:00
Richard Willars
504a6977ac Adds tests for info messages (and fixes hideInfo method) 2017-09-12 09:09:25 +01:00
Artur Paikin
df659c5417 Merge pull request #328 from transloadit/chore/dashboard
Dashboard: show()/hide()/isOpen()
2017-09-11 21:16:56 -04:00
Artur Paikin
91ec5dbdd6 refactor: openModal, closeModal, isModalOpen 2017-09-11 14:09:44 -04:00
Artur Paikin
1cdd617b8c return an array always, even with a single item 2017-09-11 10:33:52 -04:00
Richard Willars
6ecaad1bc6 Rename isOnline with updateOnlineStatus and removed params
isOnline renamed to updateOnlineStatus and removes params

updateOnlineStatus default to true

Improved the window.navigator.onLine check

Adds tests for updateOnlineStatus

Removes debug

Fixes isTouchDevice test

File cleanup

Simplifies mock for window.navigator.onLine
2017-09-11 15:01:29 +01:00
Artur Paikin
a08319fde5 lastModified is a number 2017-09-11 09:59:19 -04:00
Artur Paikin
981a331c10 allow “selector” to be a DOM element in findAllDOMElements too 2017-09-11 09:45:43 -04:00
Renée Kooi
383aa85025 Merge pull request #323 from goto-bus-stop/rm-upload-complete
core: Remove `core:upload-complete` event.
2017-09-11 09:59:30 +02:00
Artur Paikin
6b6ce35927 add findDOMElements that always returns an array of DOM elements 2017-09-10 21:35:10 -04:00
Artur Paikin
80636d125c fix tests
I unfortunately can’t seem to understand this test: `should execute all
the postprocessors when uploading a file` in Core.test.js:
6bee4f427f
eb771774b/src/core/Core.test.js#L388

@richardwillars could you please help explain why the fileID is used
there and how, and if it’s wrong to change it the way I did here?
2017-09-10 20:53:18 -04:00
Artur Paikin
bd8345a166 Better generateFileID
Fixes #317
2017-09-10 19:56:31 -04:00
Artur Paikin
1e2a722b08 fix FileItem source icon position and copy 2017-09-10 14:24:20 -04:00
Artur Paikin
1c2e4425c8 remove unused styles 2017-09-10 14:12:36 -04:00
Artur Paikin
fbf53b4576 Merge pull request #321 from goto-bus-stop/chore/unmagic
transloadit: remove `this.state` getter
2017-09-09 19:16:33 -04:00
Artur Paikin
5d30474c43 Merge pull request #310 from richardwillars/jest-tests
Jest tests
2017-09-09 19:14:18 -04:00
Renée Kooi
d4e5daa630
xhrupload,tus: Use promise-settle 2017-09-09 14:08:41 +02:00