@antv/g-plugin-dragndrop
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -1,2 +0,2 @@ | ||
!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";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;r>n;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};function o(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}function i(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&o[3]>s[1])){a.label=s[1];break}if(6===s[0]&&o[1]>a.label){a.label=o[1],o=s;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var a=function(){function t(t){this.dragndropPluginOptions=t}return t.prototype.apply=function(e){var n=this,r=e.renderingService,a=e.renderingContext.root.ownerDocument,s=a.defaultView,c=function(t){var e=t.target,r=e===a,c=r&&n.dragndropPluginOptions.isDocumentDraggable?a:e.closest&&e.closest("[draggable=true]");if(c){var l=!1,p=t.timeStamp,u=[t.clientX,t.clientY],d=null,f=[t.clientX,t.clientY],g=function(t){return o(n,void 0,void 0,(function(){var n,o,s,g,h,v;return i(this,(function(i){switch(i.label){case 0:if(!l){if(n=t.timeStamp-p,o=Math.sqrt(((y=[t.clientX,t.clientY])[0]-(b=u)[0])*(y[0]-b[0])+(y[1]-b[1])*(y[1]-b[1])),this.dragndropPluginOptions.dragstartTimeThreshold>=n||this.dragndropPluginOptions.dragstartDistanceThreshold>=o)return[2];t.type="dragstart",c.dispatchEvent(t),l=!0}return t.type="drag",t.dx=t.clientX-f[0],t.dy=t.clientY-f[1],c.dispatchEvent(t),f=[t.clientX,t.clientY],r?[3,2]:(s="pointer"===this.dragndropPluginOptions.overlap?[t.canvasX,t.canvasY]:e.getBounds().center,[4,a.elementsFromPoint(s[0],s[1])]);case 1:g=i.sent(),h=g[g.indexOf(e)+1],v=(null==h?void 0:h.closest("[droppable=true]"))||(this.dragndropPluginOptions.isDocumentDroppable?a:null),d!==v&&(d&&(t.type="dragleave",t.target=d,d.dispatchEvent(t)),v&&(t.type="dragenter",t.target=v,v.dispatchEvent(t)),(d=v)&&(t.type="dragover",t.target=d,d.dispatchEvent(t))),i.label=2;case 2:return[2]}var y,b}))}))};s.addEventListener("pointermove",g);var h=function(t){if(l){t.detail={preventClick:!0};var e=t.clone();d&&(e.type="drop",e.target=d,d.dispatchEvent(e)),e.type="dragend",c.dispatchEvent(e),l=!1}s.removeEventListener("pointermove",g)};e.addEventListener("pointerup",h,{once:!0}),e.addEventListener("pointerupoutside",h,{once:!0})}};r.hooks.init.tap(t.tag,(function(){s.addEventListener("pointerdown",c)})),r.hooks.destroy.tap(t.tag,(function(){s.removeEventListener("pointerdown",c)}))},t.tag="Dragndrop",t}(),s=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="dragndrop",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.init=function(){this.addRenderingPlugin(new a(r({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e.prototype.setOptions=function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)},e}(e.AbstractRendererPlugin);t.Plugin=s})); | ||
!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";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;r>n;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};function o(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}function i(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&o[3]>s[1])){a.label=s[1];break}if(6===s[0]&&o[1]>a.label){a.label=o[1],o=s;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}"function"==typeof SuppressedError&&SuppressedError;var a=function(){function t(t){this.dragndropPluginOptions=t}return t.prototype.apply=function(e){var n=this,r=e.renderingService,a=e.renderingContext.root.ownerDocument,s=a.defaultView,c=function(t){var e=t.target,r=e===a,c=r&&n.dragndropPluginOptions.isDocumentDraggable?a:e.closest&&e.closest("[draggable=true]");if(c){var p=!1,l=t.timeStamp,u=[t.clientX,t.clientY],d=null,f=[t.clientX,t.clientY],g=function(t){return o(n,void 0,void 0,(function(){var n,o,s,g,h,v;return i(this,(function(i){switch(i.label){case 0:if(!p){if(n=t.timeStamp-l,o=Math.sqrt(((y=[t.clientX,t.clientY])[0]-(b=u)[0])*(y[0]-b[0])+(y[1]-b[1])*(y[1]-b[1])),this.dragndropPluginOptions.dragstartTimeThreshold>=n||this.dragndropPluginOptions.dragstartDistanceThreshold>=o)return[2];t.type="dragstart",c.dispatchEvent(t),p=!0}return t.type="drag",t.dx=t.clientX-f[0],t.dy=t.clientY-f[1],c.dispatchEvent(t),f=[t.clientX,t.clientY],r?[3,2]:(s="pointer"===this.dragndropPluginOptions.overlap?[t.canvasX,t.canvasY]:e.getBounds().center,[4,a.elementsFromPoint(s[0],s[1])]);case 1:g=i.sent(),h=g[g.indexOf(e)+1],v=(null==h?void 0:h.closest("[droppable=true]"))||(this.dragndropPluginOptions.isDocumentDroppable?a:null),d!==v&&(d&&(t.type="dragleave",t.target=d,d.dispatchEvent(t)),v&&(t.type="dragenter",t.target=v,v.dispatchEvent(t)),(d=v)&&(t.type="dragover",t.target=d,d.dispatchEvent(t))),i.label=2;case 2:return[2]}var y,b}))}))};s.addEventListener("pointermove",g);var h=function(t){if(p){t.detail={preventClick:!0};var e=t.clone();d&&(e.type="drop",e.target=d,d.dispatchEvent(e)),e.type="dragend",c.dispatchEvent(e),p=!1}s.removeEventListener("pointermove",g)};e.addEventListener("pointerup",h,{once:!0}),e.addEventListener("pointerupoutside",h,{once:!0})}};r.hooks.init.tap(t.tag,(function(){s.addEventListener("pointerdown",c)})),r.hooks.destroy.tap(t.tag,(function(){s.removeEventListener("pointerdown",c)}))},t.tag="Dragndrop",t}(),s=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="dragndrop",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.init=function(){this.addRenderingPlugin(new a(r({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e.prototype.setOptions=function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)},e}(e.AbstractRendererPlugin);t.Plugin=s})); | ||
//# sourceMappingURL=index.umd.min.js.map |
{ | ||
"name": "@antv/g-plugin-dragndrop", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "A G plugin for Drag n Drop implemented with PointerEvents", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
"tslib": "^2.5.3", | ||
"@antv/g-lite": "2.0.9" | ||
"@antv/g-lite": "2.0.11" | ||
}, | ||
@@ -40,0 +40,0 @@ "publishConfig": { |
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
65202
+ Added@antv/g-lite@2.0.11(transitive)
- Removed@antv/g-lite@2.0.9(transitive)
Updated@antv/g-lite@2.0.11