@antv/g-plugin-dragndrop
Advanced tools
Comparing version 1.6.11 to 1.6.12
@@ -1,10 +0,12 @@ | ||
import type { RenderingPlugin, RenderingService } from '@antv/g'; | ||
import { SceneGraphService } from '@antv/g'; | ||
import type { RenderingPlugin, RenderingService } from '@antv/g-lite'; | ||
import { RenderingContext, SceneGraphService } from '@antv/g-lite'; | ||
import { DragndropPluginOptions } from './tokens'; | ||
export declare class DragndropPlugin implements RenderingPlugin { | ||
static tag: string; | ||
protected sceneGraphService: SceneGraphService; | ||
private renderingContext; | ||
private dragndropPluginOptions; | ||
static tag: string; | ||
constructor(sceneGraphService: SceneGraphService, renderingContext: RenderingContext, dragndropPluginOptions: DragndropPluginOptions); | ||
apply(renderingService: RenderingService): void; | ||
} | ||
//# sourceMappingURL=DragndropPlugin.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { AbstractRendererPlugin } from '@antv/g'; | ||
import { AbstractRendererPlugin } from '@antv/g-lite'; | ||
import { DragndropPluginOptions } from './tokens'; | ||
@@ -3,0 +3,0 @@ export declare class Plugin extends AbstractRendererPlugin { |
@@ -1,3 +0,3 @@ | ||
import { Syringe, inject, SceneGraphService, RenderingContext, singleton, RenderingPluginContribution, Module, AbstractRendererPlugin } from '@antv/g'; | ||
import { __decorate, __metadata } from 'tslib'; | ||
import { Syringe, singleton, RenderingPluginContribution, inject, SceneGraphService, RenderingContext, Module, AbstractRendererPlugin } from '@antv/g-lite'; | ||
import { __decorate, __param } from 'tslib'; | ||
import { distanceSquareRoot } from '@antv/util'; | ||
@@ -424,6 +424,9 @@ | ||
var DragndropPlugin = DragndropPlugin_1 = (_class = /*#__PURE__*/function () { | ||
function DragndropPlugin() { | ||
function DragndropPlugin(sceneGraphService, renderingContext, dragndropPluginOptions) { | ||
this.sceneGraphService = void 0; | ||
this.renderingContext = void 0; | ||
this.dragndropPluginOptions = void 0; | ||
this.sceneGraphService = sceneGraphService; | ||
this.renderingContext = renderingContext; | ||
this.dragndropPluginOptions = dragndropPluginOptions; | ||
} | ||
@@ -608,12 +611,5 @@ | ||
}(), _class.tag = 'Dragndrop', _class); | ||
__decorate([inject(SceneGraphService), __metadata("design:type", Object)], DragndropPlugin.prototype, "sceneGraphService", void 0); | ||
__decorate([inject(RenderingContext), __metadata("design:type", Object)], DragndropPlugin.prototype, "renderingContext", void 0); | ||
__decorate([inject(DragndropPluginOptions), __metadata("design:type", Object)], DragndropPlugin.prototype, "dragndropPluginOptions", void 0); | ||
DragndropPlugin = DragndropPlugin_1 = __decorate([singleton({ | ||
contrib: RenderingPluginContribution | ||
})], DragndropPlugin); | ||
}), __param(0, inject(SceneGraphService)), __param(1, inject(RenderingContext)), __param(2, inject(DragndropPluginOptions))], DragndropPlugin); | ||
@@ -620,0 +616,0 @@ var containerModule = Module(function (register) { |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var g = require('@antv/g'); | ||
var gLite = require('@antv/g-lite'); | ||
var tslib = require('tslib'); | ||
@@ -423,3 +423,3 @@ var util = require('@antv/util'); | ||
var DragndropPluginOptions = g.Syringe.defineToken(''); | ||
var DragndropPluginOptions = gLite.Syringe.defineToken(''); | ||
@@ -430,6 +430,9 @@ var _class; | ||
var DragndropPlugin = DragndropPlugin_1 = (_class = /*#__PURE__*/function () { | ||
function DragndropPlugin() { | ||
function DragndropPlugin(sceneGraphService, renderingContext, dragndropPluginOptions) { | ||
this.sceneGraphService = void 0; | ||
this.renderingContext = void 0; | ||
this.dragndropPluginOptions = void 0; | ||
this.sceneGraphService = sceneGraphService; | ||
this.renderingContext = renderingContext; | ||
this.dragndropPluginOptions = dragndropPluginOptions; | ||
} | ||
@@ -614,14 +617,7 @@ | ||
}(), _class.tag = 'Dragndrop', _class); | ||
DragndropPlugin = DragndropPlugin_1 = tslib.__decorate([gLite.singleton({ | ||
contrib: gLite.RenderingPluginContribution | ||
}), tslib.__param(0, gLite.inject(gLite.SceneGraphService)), tslib.__param(1, gLite.inject(gLite.RenderingContext)), tslib.__param(2, gLite.inject(DragndropPluginOptions))], DragndropPlugin); | ||
tslib.__decorate([g.inject(g.SceneGraphService), tslib.__metadata("design:type", Object)], DragndropPlugin.prototype, "sceneGraphService", void 0); | ||
tslib.__decorate([g.inject(g.RenderingContext), tslib.__metadata("design:type", Object)], DragndropPlugin.prototype, "renderingContext", void 0); | ||
tslib.__decorate([g.inject(DragndropPluginOptions), tslib.__metadata("design:type", Object)], DragndropPlugin.prototype, "dragndropPluginOptions", void 0); | ||
DragndropPlugin = DragndropPlugin_1 = tslib.__decorate([g.singleton({ | ||
contrib: g.RenderingPluginContribution | ||
})], DragndropPlugin); | ||
var containerModule = g.Module(function (register) { | ||
var containerModule = gLite.Module(function (register) { | ||
register(DragndropPlugin); | ||
@@ -667,4 +663,4 @@ }); | ||
return Plugin; | ||
}(g.AbstractRendererPlugin); | ||
}(gLite.AbstractRendererPlugin); | ||
exports.Plugin = Plugin; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@antv/g'], factory) : | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g-lite')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@antv/g-lite'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.Dragndrop = {}), global.window.G)); | ||
}(this, (function (exports, g) { 'use strict'; | ||
}(this, (function (exports, gLite) { 'use strict'; | ||
@@ -442,4 +442,4 @@ function _regeneratorRuntime() { | ||
function __metadata(metadataKey, metadataValue) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
function __param(paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
} | ||
@@ -451,3 +451,3 @@ | ||
var DragndropPluginOptions = g.Syringe.defineToken(''); | ||
var DragndropPluginOptions = gLite.Syringe.defineToken(''); | ||
@@ -458,6 +458,9 @@ var _class; | ||
var DragndropPlugin = DragndropPlugin_1 = (_class = /*#__PURE__*/function () { | ||
function DragndropPlugin() { | ||
function DragndropPlugin(sceneGraphService, renderingContext, dragndropPluginOptions) { | ||
this.sceneGraphService = void 0; | ||
this.renderingContext = void 0; | ||
this.dragndropPluginOptions = void 0; | ||
this.sceneGraphService = sceneGraphService; | ||
this.renderingContext = renderingContext; | ||
this.dragndropPluginOptions = dragndropPluginOptions; | ||
} | ||
@@ -642,14 +645,7 @@ | ||
}(), _class.tag = 'Dragndrop', _class); | ||
DragndropPlugin = DragndropPlugin_1 = __decorate([gLite.singleton({ | ||
contrib: gLite.RenderingPluginContribution | ||
}), __param(0, gLite.inject(gLite.SceneGraphService)), __param(1, gLite.inject(gLite.RenderingContext)), __param(2, gLite.inject(DragndropPluginOptions))], DragndropPlugin); | ||
__decorate([g.inject(g.SceneGraphService), __metadata("design:type", Object)], DragndropPlugin.prototype, "sceneGraphService", void 0); | ||
__decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], DragndropPlugin.prototype, "renderingContext", void 0); | ||
__decorate([g.inject(DragndropPluginOptions), __metadata("design:type", Object)], DragndropPlugin.prototype, "dragndropPluginOptions", void 0); | ||
DragndropPlugin = DragndropPlugin_1 = __decorate([g.singleton({ | ||
contrib: g.RenderingPluginContribution | ||
})], DragndropPlugin); | ||
var containerModule = g.Module(function (register) { | ||
var containerModule = gLite.Module(function (register) { | ||
register(DragndropPlugin); | ||
@@ -695,3 +691,3 @@ }); | ||
return Plugin; | ||
}(g.AbstractRendererPlugin); | ||
}(gLite.AbstractRendererPlugin); | ||
@@ -698,0 +694,0 @@ exports.Plugin = Plugin; |
@@ -1,3 +0,3 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","@antv/g"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Dragndrop={}),t.window.G)}(this,(function(t,e){"use strict";function r(){ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Dragndrop={}),t.window.G)}(this,(function(t,e){"use strict";function r(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),i=new O(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function p(){}function h(){}function d(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(j([])));g&&g!==e&&n.call(g,i)&&(v=g);var m=d.prototype=p.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=d,u(m,"constructor",d),u(d,"constructor",h),h.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},i.apply(this,arguments)}function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}function c(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var s,f,l=e.Syringe.defineToken(""),p=(s=function(){function t(){this.sceneGraphService=void 0,this.renderingContext=void 0,this.dragndropPluginOptions=void 0}return t.prototype.apply=function(t){var e=this.renderingContext.root.ownerDocument,n=e.defaultView,i=this.dragndropPluginOptions,a=i.overlap,c=i.isDocumentDraggable,u=i.isDocumentDroppable,s=i.dragstartDistanceThreshold,l=i.dragstartTimeThreshold,p=function(t){var i=t.target,f=i===e,p=f&&c?e:i.closest&&i.closest("[draggable=true]");if(p){var h=function(){var t=o(r().mark((function t(n){var o,c,h,w,b,x;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(d){t.next=8;break}if(o=n.timeStamp-v,r=[n.clientX,n.clientY],E=y,c=Math.sqrt((r[0]-E[0])*(r[0]-E[0])+(r[1]-E[1])*(r[1]-E[1])),o>l&&c>s){t.next=5;break}return t.abrupt("return");case 5:n.type="dragstart",p.dispatchEvent(n),d=!0;case 8:if(n.type="drag",n.dx=n.clientX-m[0],n.dy=n.clientY-m[1],p.dispatchEvent(n),m=[n.clientX,n.clientY],f){t.next=21;break}return h="pointer"===a?[n.canvasX,n.canvasY]:i.getBounds().center,t.next=17,e.elementsFromPoint(h[0],h[1]);case 17:b=(w=t.sent)[w.indexOf(i)+1],x=(null==b?void 0:b.closest("[droppable=true]"))||(u?e:null),g!==x&&(g&&(n.type="dragleave",n.target=g,g.dispatchEvent(n)),x&&(n.type="dragenter",n.target=x,x.dispatchEvent(n)),(g=x)&&(n.type="dragover",n.target=g,g.dispatchEvent(n)));case 21:case"end":return t.stop()}var r,E}),t)})));return function(e){return t.apply(this,arguments)}}(),d=!1,v=t.timeStamp,y=[t.clientX,t.clientY],g=null,m=[t.clientX,t.clientY];n.addEventListener("pointermove",h);var w=function(){d&&(g&&(t.type="drop",t.target=g,g.dispatchEvent(t)),t.type="dragend",t.detail={preventClick:!0},p.dispatchEvent(t),d=!1),n.removeEventListener("pointermove",h)};i.addEventListener("pointerup",w,{once:!0}),i.addEventListener("pointerupoutside",w,{once:!0})}};t.hooks.init.tapPromise(f.tag,o(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.addEventListener("pointerdown",p);case 1:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(f.tag,(function(){n.removeEventListener("pointerdown",p)}))},t}(),s.tag="Dragndrop",f=s);c([e.inject(e.SceneGraphService),u("design:type",Object)],p.prototype,"sceneGraphService",void 0),c([e.inject(e.RenderingContext),u("design:type",Object)],p.prototype,"renderingContext",void 0),c([e.inject(l),u("design:type",Object)],p.prototype,"dragndropPluginOptions",void 0),p=f=c([e.singleton({contrib:e.RenderingPluginContribution})],p);var h=e.Module((function(t){t(p)}));t.Plugin=function(t){var e,r;function n(e){var r;return void 0===e&&(e={}),(r=t.call(this)||this).options=void 0,r.name="dragndrop",r.options=e,r}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,a(e,r);var o=n.prototype;return o.init=function(){this.container.register(l,{useValue:i({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)}),this.container.load(h,!0)},o.destroy=function(){this.container.remove(l),this.container.unload(h)},n}(e.AbstractRendererPlugin),Object.defineProperty(t,"__esModule",{value:!0})})); | ||
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new O(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f={};function h(){}function p(){}function d(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(j([])));g&&g!==e&&n.call(g,i)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return p.prototype=d,u(m,"constructor",d),u(d,"constructor",p),p.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},i.apply(this,arguments)}function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}function c(t,e){return function(r,n){e(r,n,t)}}var u,s,l=e.Syringe.defineToken(""),f=(u=function(){function t(t,e,r){this.sceneGraphService=void 0,this.renderingContext=void 0,this.dragndropPluginOptions=void 0,this.sceneGraphService=t,this.renderingContext=e,this.dragndropPluginOptions=r}return t.prototype.apply=function(t){var e=this.renderingContext.root.ownerDocument,n=e.defaultView,i=this.dragndropPluginOptions,a=i.overlap,c=i.isDocumentDraggable,u=i.isDocumentDroppable,l=i.dragstartDistanceThreshold,f=i.dragstartTimeThreshold,h=function(t){var i=t.target,s=i===e,h=s&&c?e:i.closest&&i.closest("[draggable=true]");if(h){var p=function(){var t=o(r().mark((function t(n){var o,c,p,w,b,x;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(d){t.next=8;break}if(o=n.timeStamp-v,r=[n.clientX,n.clientY],E=y,c=Math.sqrt((r[0]-E[0])*(r[0]-E[0])+(r[1]-E[1])*(r[1]-E[1])),o>f&&c>l){t.next=5;break}return t.abrupt("return");case 5:n.type="dragstart",h.dispatchEvent(n),d=!0;case 8:if(n.type="drag",n.dx=n.clientX-m[0],n.dy=n.clientY-m[1],h.dispatchEvent(n),m=[n.clientX,n.clientY],s){t.next=21;break}return p="pointer"===a?[n.canvasX,n.canvasY]:i.getBounds().center,t.next=17,e.elementsFromPoint(p[0],p[1]);case 17:b=(w=t.sent)[w.indexOf(i)+1],x=(null==b?void 0:b.closest("[droppable=true]"))||(u?e:null),g!==x&&(g&&(n.type="dragleave",n.target=g,g.dispatchEvent(n)),x&&(n.type="dragenter",n.target=x,x.dispatchEvent(n)),(g=x)&&(n.type="dragover",n.target=g,g.dispatchEvent(n)));case 21:case"end":return t.stop()}var r,E}),t)})));return function(e){return t.apply(this,arguments)}}(),d=!1,v=t.timeStamp,y=[t.clientX,t.clientY],g=null,m=[t.clientX,t.clientY];n.addEventListener("pointermove",p);var w=function(){d&&(g&&(t.type="drop",t.target=g,g.dispatchEvent(t)),t.type="dragend",t.detail={preventClick:!0},h.dispatchEvent(t),d=!1),n.removeEventListener("pointermove",p)};i.addEventListener("pointerup",w,{once:!0}),i.addEventListener("pointerupoutside",w,{once:!0})}};t.hooks.init.tapPromise(s.tag,o(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.addEventListener("pointerdown",h);case 1:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(s.tag,(function(){n.removeEventListener("pointerdown",h)}))},t}(),u.tag="Dragndrop",s=u);f=s=function(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}([e.singleton({contrib:e.RenderingPluginContribution}),c(0,e.inject(e.SceneGraphService)),c(1,e.inject(e.RenderingContext)),c(2,e.inject(l))],f);var h=e.Module((function(t){t(f)}));t.Plugin=function(t){var e,r;function n(e){var r;return void 0===e&&(e={}),(r=t.call(this)||this).options=void 0,r.name="dragndrop",r.options=e,r}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,a(e,r);var o=n.prototype;return o.init=function(){this.container.register(l,{useValue:i({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)}),this.container.load(h,!0)},o.destroy=function(){this.container.remove(l),this.container.unload(h)},n}(e.AbstractRendererPlugin),Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -1,2 +0,2 @@ | ||
import { Syringe } from '@antv/g'; | ||
import { Syringe } from '@antv/g-lite'; | ||
export declare const DragndropPluginOptions: Syringe.DefinedToken; | ||
@@ -3,0 +3,0 @@ export interface DragndropPluginOptions { |
{ | ||
"name": "@antv/g-plugin-dragndrop", | ||
"version": "1.6.11", | ||
"version": "1.6.12", | ||
"description": "A G plugin for Drag n Drop implemented with PointerEvents", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@antv/g": "^5.0.1" | ||
"@antv/g-lite": "^1.0.0" | ||
}, | ||
@@ -43,3 +43,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "32c0eab45e1b2350b9d1b12895b05e90e1fc7971" | ||
"gitHead": "d2a0433cdcc3f58ba90513d1054dd824ab1491a5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1779
94448