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 =
|
19 |
|
20 | function (_Plugin) {
|
21 | _inheritsLoose(OneDrive, _Plugin);
|
22 |
|
23 | function OneDrive(uppy, opts) {
|
24 | var _this;
|
25 |
|
26 | _this = _Plugin.call(this, uppy, opts) || this;
|
27 | _this.id = _this.opts.id || 'OneDrive';
|
28 | Provider.initPlugin(_assertThisInitialized(_this), opts);
|
29 | _this.title = _this.opts.title || 'OneDrive';
|
30 |
|
31 | _this.icon = function () {
|
32 | return h("svg", {
|
33 | "aria-hidden": "true",
|
34 | focusable: "false",
|
35 | width: "32",
|
36 | height: "32",
|
37 | viewBox: "0 0 32 32",
|
38 | xmlns: "http://www.w3.org/2000/svg"
|
39 | }, h("g", {
|
40 | fill: "none",
|
41 | "fill-rule": "evenodd"
|
42 | }, h("rect", {
|
43 | width: "32",
|
44 | height: "32",
|
45 | rx: "16",
|
46 | fill: "#0262C0"
|
47 | }), h("g", {
|
48 | fill: "#FFF",
|
49 | "fill-rule": "nonzero"
|
50 | }, h("path", {
|
51 | d: "M24.157 22s1.492-.205 1.79-1.655a2.624 2.624 0 0 0 .03-.878c-.22-1.64-1.988-2.01-1.988-2.01s.307-1.765-1.312-2.69c-1.62-.925-3.1 0-3.1 0S18.711 13 16.366 13c-3.016 0-3.519 3.448-3.519 3.448S10 16.618 10 19.14c0 2.523 2.597 2.86 2.597 2.86h11.56z"
|
52 | }), h("path", {
|
53 | d: "M9.421 19.246c0-2.197 1.606-3.159 2.871-3.472.44-1.477 1.654-3.439 4.135-3.439H16.445c1.721 0 2.79.823 3.368 1.476a3.99 3.99 0 0 1 1.147-.171h.01l.03.002C21.017 13.5 20.691 10 16.757 10c-2.69 0-3.639 2.345-3.639 2.345s-1.95-1.482-3.955.567c-1.028 1.052-.79 2.669-.79 2.669S6 15.824 6 18.412C6 20.757 8.452 21 8.452 21h1.372a3.77 3.77 0 0 1-.403-1.754z"
|
54 | }))));
|
55 | };
|
56 |
|
57 | _this.provider = new Provider(uppy, {
|
58 | companionUrl: _this.opts.companionUrl,
|
59 | companionHeaders: _this.opts.companionHeaders || _this.opts.serverHeaders,
|
60 | provider: 'onedrive',
|
61 | pluginId: _this.id
|
62 | });
|
63 | _this.onFirstRender = _this.onFirstRender.bind(_assertThisInitialized(_this));
|
64 | _this.render = _this.render.bind(_assertThisInitialized(_this));
|
65 | return _this;
|
66 | }
|
67 |
|
68 | var _proto = OneDrive.prototype;
|
69 |
|
70 | _proto.install = function install() {
|
71 | this.view = new ProviderViews(this, {
|
72 | provider: this.provider
|
73 | });
|
74 |
|
75 | this.setPluginState({
|
76 | authenticated: false,
|
77 | files: [],
|
78 | folders: [],
|
79 | directories: [],
|
80 | activeRow: -1,
|
81 | filterInput: '',
|
82 | isSearchVisible: false
|
83 | });
|
84 | var target = this.opts.target;
|
85 |
|
86 | if (target) {
|
87 | this.mount(target, this);
|
88 | }
|
89 | };
|
90 |
|
91 | _proto.uninstall = function uninstall() {
|
92 | this.view.tearDown();
|
93 | this.unmount();
|
94 | };
|
95 |
|
96 | _proto.onFirstRender = function onFirstRender() {
|
97 | return this.view.getFolder();
|
98 | };
|
99 |
|
100 | _proto.render = function render(state) {
|
101 | return this.view.render(state);
|
102 | };
|
103 |
|
104 | return OneDrive;
|
105 | }(Plugin), _class.VERSION = "1.1.2", _temp); |
\ | No newline at end of file |