@scaleflex/widget-attach-dnd 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6762 -0
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/lib/index.js +209 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 scaleflex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# `@scaleflex/widget-attach-dnd`
|
|
2
|
+
|
|
3
|
+
[![Plugins][plugins-image]](#plugins)
|
|
4
|
+
[![Website][filerobot-image]][sfx-url]
|
|
5
|
+
[![Version][filerobot-version]][version-url]
|
|
6
|
+
[![Scaleflex team][made-by-image]][sfx-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
|
+
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<div align='center'>
|
|
12
|
+
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://cdn.scaleflex.com/plugins/filerobot-widget/assets/filerobot_widget_logo_with_fire.png?vh=b2ff09" width="140"/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Attaches drag & drop (dnd) zone of the Scaleflex widget to some HTML element of your page [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core).
|
|
17
|
+
|
|
18
|
+
> Note: This plugin requires [@scaleflex/widget-explorer](../@scaleflex/widget-explorer) plugin to be existed & used in the widget, as the `attach-dnd` plugin role is only attaching the drag & drop zone to some element of your page and the rest is handled through the explorer & widget.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### NPM
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install --save @scaleflex/widget-attach-dnd
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### YARN
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn add @scaleflex/widget-attach-dnd
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
then
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import AttachDragAndDrop from '@scaleflex/widget-attach-dnd'
|
|
38
|
+
...
|
|
39
|
+
...
|
|
40
|
+
...
|
|
41
|
+
scaleflexWidget.use(AttachDragAndDrop, propertiesObject)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### CDN
|
|
45
|
+
|
|
46
|
+
If installed via a [CDN link](../@scaleflex/widget-core#installation), the plugin is inside the `ScaleflexWidget` global object as `ScaleflexWidget.AttachDnD`
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const AttachDragAndDrop = window.ScaleflexWidget.AttachDnD
|
|
50
|
+
...
|
|
51
|
+
...
|
|
52
|
+
...
|
|
53
|
+
scaleflexWidget.use(AttachDragAndDrop, propertiesObject)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Properties
|
|
57
|
+
|
|
58
|
+
Required attributes are marked with ***(Required)***.
|
|
59
|
+
|
|
60
|
+
### `target`
|
|
61
|
+
|
|
62
|
+
<u>Type:</u> `string or HTML Element` **_Required_**.
|
|
63
|
+
|
|
64
|
+
<u>Default:</u> `document.body`
|
|
65
|
+
|
|
66
|
+
The selector (ID, Class) of an HTML element or an existed HTML element that would be attached with the drag & drop zone, also the drop hint would be shown to this target selector's element, by default it's the body of the document page.
|
|
67
|
+
|
|
68
|
+
### `fixedDropHint`
|
|
69
|
+
|
|
70
|
+
<u>Type:</u> `boolean`.
|
|
71
|
+
|
|
72
|
+
<u>Default:</u> `false`
|
|
73
|
+
|
|
74
|
+
If set to `true`, the drop hint shown while dragging the file/folder on the `target` element would be in a fixed position.
|
|
75
|
+
|
|
76
|
+
> Note: it might be useful to use this property if your page scroll and the drop zone doesn't keep in the same scroll position.
|
|
77
|
+
|
|
78
|
+
### `noDropHint`
|
|
79
|
+
|
|
80
|
+
<u>Type:</u> `boolean`.
|
|
81
|
+
|
|
82
|
+
<u>Default:</u> `false`
|
|
83
|
+
|
|
84
|
+
If you don't want to show the drop hint shown while dragging the file/folder over the target element then provide `true` value here, otherwise it would be shown normally.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<!-- Variables -->
|
|
88
|
+
|
|
89
|
+
[npm-url]: https://www.npmjs.com/package/@scaleflex/widget-attach-dnd
|
|
90
|
+
[license-url]: https://opensource.org/licenses/MIT
|
|
91
|
+
[sfx-url]: https://www.scaleflex.com/
|
|
92
|
+
[version-url]: https://www.npmjs.com/package/@scaleflex/widget-attach-dnd
|
|
93
|
+
[codeSandbox-url]: https://codesandbox.io/s/filerobot-widget-v3-c5l9th
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
[npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
|
|
97
|
+
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
|
|
98
|
+
[made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
|
|
99
|
+
[plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
|
|
100
|
+
[filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
|
|
101
|
+
[filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-attach-dnd?label=Version&style=for-the-badge&logo=npm
|
|
102
|
+
[codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
9
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
12
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
13
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
14
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
15
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
import { createElement } from 'react';
|
|
21
|
+
import { createRoot } from 'react-dom/client';
|
|
22
|
+
import { Plugin } from '@scaleflex/widget-core';
|
|
23
|
+
import Explorer from '@scaleflex/widget-explorer';
|
|
24
|
+
import isDragDropSupported from '@scaleflex/widget-utils/lib/isDragDropSupported';
|
|
25
|
+
import getDroppedFiles from '@scaleflex/widget-utils/lib/getDroppedFiles';
|
|
26
|
+
import findDOMElement from '@scaleflex/widget-utils/lib/findDOMElement';
|
|
27
|
+
import { DropFilesWindow } from '@scaleflex/widget-common';
|
|
28
|
+
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
29
|
+
// TODO: find a way to show version of the current plugin
|
|
30
|
+
// why solution below isn't good?
|
|
31
|
+
// first import doesn't work with webpack 5 as it was deprecated
|
|
32
|
+
// second import fixes webpack 5 issue as it was mentioned in their docs
|
|
33
|
+
// but it exposes our package.json to the client and it is mentioned as security rist in mutiple places
|
|
34
|
+
// https://github.com/axelpale/genversion
|
|
35
|
+
// https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version
|
|
36
|
+
// https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code/10855054#10855054
|
|
37
|
+
// import { version } from '../package.json'
|
|
38
|
+
// import packageInfo from '../package.json'
|
|
39
|
+
var AttachDragAndDrop = /*#__PURE__*/function (_Plugin) {
|
|
40
|
+
// static VERSION = packageInfo.version
|
|
41
|
+
|
|
42
|
+
function AttachDragAndDrop(filerobot) {
|
|
43
|
+
var _this;
|
|
44
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
45
|
+
_classCallCheck(this, AttachDragAndDrop);
|
|
46
|
+
_this = _callSuper(this, AttachDragAndDrop, [filerobot, opts]);
|
|
47
|
+
_defineProperty(_this, "addFiles", function (files) {
|
|
48
|
+
var descriptors = files.map(function (file) {
|
|
49
|
+
return {
|
|
50
|
+
source: _this.id,
|
|
51
|
+
name: file.name,
|
|
52
|
+
type: file.type,
|
|
53
|
+
data: file,
|
|
54
|
+
meta: {
|
|
55
|
+
relativePath: file.relativePath || null
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
try {
|
|
60
|
+
_this.filerobot.addFiles(descriptors);
|
|
61
|
+
} catch (err) {
|
|
62
|
+
_this.filerobot.info(err, 'warning');
|
|
63
|
+
_this.filerobot.log(err);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
_defineProperty(_this, "handleDragEnter", function (event) {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
if (_this.dropHintElement) {
|
|
70
|
+
_this.dropHintElement.style.visibility = 'visible';
|
|
71
|
+
_this._oldTargetPosition = _this.targetElement.style.position || 'initial';
|
|
72
|
+
_this._oldTargetMinHeight = _this.targetElement.style.minHeight || 'initial';
|
|
73
|
+
_this.targetElement.style.position = 'relative';
|
|
74
|
+
_this.targetElement.style.minHeight = '150px';
|
|
75
|
+
}
|
|
76
|
+
_this.targetElement.classList.add('filerobot-common-DropFilesTarget');
|
|
77
|
+
_this._isDragging = true;
|
|
78
|
+
});
|
|
79
|
+
_defineProperty(_this, "handleDragOver", function (event) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
83
|
+
});
|
|
84
|
+
_defineProperty(_this, "endDragging", function () {
|
|
85
|
+
if (_this.dropHintElement) {
|
|
86
|
+
_this.dropHintElement.style.visibility = 'hidden';
|
|
87
|
+
_this.targetElement.style.position = _this._oldTargetPosition;
|
|
88
|
+
_this.targetElement.style.minHeight = _this._oldTargetMinHeight;
|
|
89
|
+
}
|
|
90
|
+
_this.targetElement.classList.remove('filerobot-common-DropFilesTarget');
|
|
91
|
+
_this._isDragging = false;
|
|
92
|
+
});
|
|
93
|
+
_defineProperty(_this, "handleDrop", function (event) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
|
|
97
|
+
// Remove dragover class
|
|
98
|
+
_this.endDragging();
|
|
99
|
+
if (_this.explorerPlugin && !_this.explorerPlugin.opts.inline) {
|
|
100
|
+
_this.explorerPlugin.openModal();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Adding the dropped files
|
|
104
|
+
_this.filerobot.log('[AttachDragAndDrop] Files dropped.');
|
|
105
|
+
var logDropError = function logDropError(error) {
|
|
106
|
+
_this.filerobot.info(error, 'warning');
|
|
107
|
+
_this.filerobot.log(error, 'error');
|
|
108
|
+
};
|
|
109
|
+
getDroppedFiles(event.dataTransfer, {
|
|
110
|
+
logDropError: logDropError
|
|
111
|
+
}).then(function (files) {
|
|
112
|
+
return _this.addFiles(files);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
_defineProperty(_this, "handleDragLeave", function (event) {
|
|
116
|
+
if (_this._isDragging) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
_this.endDragging();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
_defineProperty(_this, "handleMouseEnter", function (event) {
|
|
122
|
+
if (_this._isDragging) {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
_this.endDragging();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
_defineProperty(_this, "addDropHintWindow", function () {
|
|
128
|
+
var newElement = document.createElement('div');
|
|
129
|
+
_this.targetElement.appendChild(newElement);
|
|
130
|
+
var style = {};
|
|
131
|
+
if (_this.opts.fixedDropHint) {
|
|
132
|
+
style.position = 'fixed';
|
|
133
|
+
}
|
|
134
|
+
var DropFilesWindowElem = /*#__PURE__*/createElement(DropFilesWindow, {
|
|
135
|
+
i18n: _this.filerobot.i18n,
|
|
136
|
+
style: style,
|
|
137
|
+
onMount: function onMount() {
|
|
138
|
+
_this.dropHintElement = newElement.lastElementChild;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
_this.root = createRoot(newElement);
|
|
142
|
+
_this.root.render(DropFilesWindowElem);
|
|
143
|
+
});
|
|
144
|
+
_defineProperty(_this, "attachEventsToTargetElement", function () {
|
|
145
|
+
if (!_this.opts.noDropHint) {
|
|
146
|
+
_this.addDropHintWindow();
|
|
147
|
+
}
|
|
148
|
+
document.addEventListener('mouseenter', _this.handleMouseEnter);
|
|
149
|
+
_this.targetElement.addEventListener('dragenter', _this.handleDragEnter);
|
|
150
|
+
_this.targetElement.addEventListener('dragover', _this.handleDragOver);
|
|
151
|
+
_this.targetElement.addEventListener('drop', _this.handleDrop);
|
|
152
|
+
_this.targetElement.addEventListener('dragleave', _this.handleDragLeave);
|
|
153
|
+
});
|
|
154
|
+
_defineProperty(_this, "detachEventsFromTargetElement", function () {
|
|
155
|
+
document.removeEventListener('mouseenter', _this.handleMouseEnter);
|
|
156
|
+
_this.targetElement.removeEventListener('dragenter', _this.handleDragEnter);
|
|
157
|
+
_this.targetElement.removeEventListener('dragover', _this.handleDragOver);
|
|
158
|
+
_this.targetElement.removeEventListener('drop', _this.handleDrop);
|
|
159
|
+
_this.targetElement.removeEventListener('dragleave', _this.handleDragLeave);
|
|
160
|
+
});
|
|
161
|
+
_this.type = 'acquirer';
|
|
162
|
+
_this.id = PLUGINS_IDS.ATTACH_DND;
|
|
163
|
+
_this.invisible = true;
|
|
164
|
+
_this.title = 'Attach Drag & Drop';
|
|
165
|
+
var defaultOptions = {
|
|
166
|
+
target: document.body,
|
|
167
|
+
fixedDropHint: false,
|
|
168
|
+
noDropHint: false
|
|
169
|
+
};
|
|
170
|
+
_this.opts = _objectSpread(_objectSpread({}, defaultOptions), opts);
|
|
171
|
+
_this.targetElement = findDOMElement(_this.opts.target);
|
|
172
|
+
_this._isDragging = false;
|
|
173
|
+
|
|
174
|
+
// Check for browser drag & drop support
|
|
175
|
+
_this.isDragDropSupported = isDragDropSupported(_this.targetElement);
|
|
176
|
+
return _this;
|
|
177
|
+
}
|
|
178
|
+
_inherits(AttachDragAndDrop, _Plugin);
|
|
179
|
+
return _createClass(AttachDragAndDrop, [{
|
|
180
|
+
key: "setOptions",
|
|
181
|
+
value: function setOptions(newOpts) {
|
|
182
|
+
_superPropGet(AttachDragAndDrop, "setOptions", this, 3)([newOpts]);
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "install",
|
|
186
|
+
value: function install() {
|
|
187
|
+
if (Explorer) {
|
|
188
|
+
this.mount(Explorer, this);
|
|
189
|
+
this.explorerPlugin = this.filerobot.getPlugin(PLUGINS_IDS.EXPLORER);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "onMount",
|
|
194
|
+
value: function onMount() {
|
|
195
|
+
if (this.isDragDropSupported) {
|
|
196
|
+
this.attachEventsToTargetElement();
|
|
197
|
+
} else {
|
|
198
|
+
console.warn('The browser/provided element doesn\'t support drag & drop.');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
key: "uninstall",
|
|
203
|
+
value: function uninstall() {
|
|
204
|
+
this.detachEventsFromTargetElement();
|
|
205
|
+
this.unmount();
|
|
206
|
+
}
|
|
207
|
+
}]);
|
|
208
|
+
}(Plugin);
|
|
209
|
+
export default AttachDragAndDrop;
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scaleflex/widget-attach-dnd",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Attaches drag & drop zone to the specified HTML target, so any file dropped in that target would be uploaded.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"/dist",
|
|
8
|
+
"/lib",
|
|
9
|
+
"/types"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@scaleflex/widget-utils": "^0.0.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"react": "^19.0.0",
|
|
19
|
+
"react-dom": "^19.0.0"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@scaleflex/widget-core": "^0.0.0",
|
|
23
|
+
"@scaleflex/widget-explorer": "^0.0.0",
|
|
24
|
+
"react": ">=19.0.0",
|
|
25
|
+
"react-dom": ">=19.0.0"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"gitHead": "64ea82e745b7deda36d6794863350e6671e9010d"
|
|
29
|
+
}
|