UNPKG

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