1 | var _class, _temp;
|
2 |
|
3 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
4 |
|
5 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
6 |
|
7 | var _require = require('@uppy/core'),
|
8 | Plugin = _require.Plugin;
|
9 |
|
10 | var _require2 = require('@uppy/companion-client'),
|
11 | Provider = _require2.Provider;
|
12 |
|
13 | var ProviderViews = require('@uppy/provider-views');
|
14 |
|
15 | var _require3 = require('preact'),
|
16 | h = _require3.h;
|
17 |
|
18 | module.exports = (_temp = _class = function (_Plugin) {
|
19 | _inheritsLoose(Dropbox, _Plugin);
|
20 |
|
21 | function Dropbox(uppy, opts) {
|
22 | var _this;
|
23 |
|
24 | _this = _Plugin.call(this, uppy, opts) || this;
|
25 | _this.id = _this.opts.id || 'Dropbox';
|
26 | Provider.initPlugin(_assertThisInitialized(_this), opts);
|
27 | _this.title = _this.opts.title || 'Dropbox';
|
28 |
|
29 | _this.icon = function () {
|
30 | return h("svg", {
|
31 | "aria-hidden": "true",
|
32 | focusable: "false",
|
33 | width: "32",
|
34 | height: "32",
|
35 | viewBox: "0 0 32 32"
|
36 | }, h("g", {
|
37 | fill: "none",
|
38 | "fill-rule": "evenodd"
|
39 | }, h("rect", {
|
40 | fill: "#0D2481",
|
41 | width: "32",
|
42 | height: "32",
|
43 | rx: "16"
|
44 | }), h("path", {
|
45 | d: "M11 8l5 3.185-5 3.186-5-3.186L11 8zm10 0l5 3.185-5 3.186-5-3.186L21 8zM6 17.556l5-3.185 5 3.185-5 3.186-5-3.186zm15-3.185l5 3.185-5 3.186-5-3.186 5-3.185zm-10 7.432l5-3.185 5 3.185-5 3.186-5-3.186z",
|
46 | fill: "#FFF",
|
47 | "fill-rule": "nonzero"
|
48 | })));
|
49 | };
|
50 |
|
51 | _this.provider = new Provider(uppy, {
|
52 | companionUrl: _this.opts.companionUrl,
|
53 | companionHeaders: _this.opts.companionHeaders || _this.opts.serverHeaders,
|
54 | provider: 'dropbox',
|
55 | pluginId: _this.id
|
56 | });
|
57 | _this.onFirstRender = _this.onFirstRender.bind(_assertThisInitialized(_this));
|
58 | _this.render = _this.render.bind(_assertThisInitialized(_this));
|
59 | return _this;
|
60 | }
|
61 |
|
62 | var _proto = Dropbox.prototype;
|
63 |
|
64 | _proto.install = function install() {
|
65 | this.view = new ProviderViews(this, {
|
66 | provider: this.provider
|
67 | });
|
68 | var target = this.opts.target;
|
69 |
|
70 | if (target) {
|
71 | this.mount(target, this);
|
72 | }
|
73 | };
|
74 |
|
75 | _proto.uninstall = function uninstall() {
|
76 | this.view.tearDown();
|
77 | this.unmount();
|
78 | };
|
79 |
|
80 | _proto.onFirstRender = function onFirstRender() {
|
81 | return this.view.getFolder();
|
82 | };
|
83 |
|
84 | _proto.render = function render(state) {
|
85 | return this.view.render(state);
|
86 | };
|
87 |
|
88 | return Dropbox;
|
89 | }(Plugin), _class.VERSION = "1.4.15", _temp); |
\ | No newline at end of file |