Merge branch 'master' of http://bore.pub:10439/r/ERP_override
New file |
| | |
| | | { |
| | | "name": "north-glass-erp", |
| | | "lockfileVersion": 2, |
| | | "requires": true, |
| | | "packages": { |
| | | "node_modules/default-passive-events": { |
| | | "version": "2.0.0", |
| | | "resolved": "https://registry.npmjs.org/default-passive-events/-/default-passive-events-2.0.0.tgz", |
| | | "integrity": "sha512-eMtt76GpDVngZQ3ocgvRcNCklUMwID1PaNbCNxfpDXuiOXttSh0HzBbda1HU9SIUsDc02vb7g9+3I5tlqe/qMQ==" |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | The MIT License (MIT) |
| | | |
| | | Copyright (c) 2016 Hector Zarco |
| | | |
| | | Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | of this software and associated documentation files (the "Software"), to deal |
| | | in the Software without restriction, including without limitation the rights |
| | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| | | copies of the Software, and to permit persons to whom the Software is |
| | | furnished to do so, subject to the following conditions: |
| | | |
| | | The above copyright notice and this permission notice shall be included in all |
| | | copies or substantial portions of the Software. |
| | | |
| | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| | | SOFTWARE. |
New file |
| | |
| | | # `default-passive-events` [](https://travis-ci.org/zzarcon/default-passive-events) [](https://david-dm.org/zzarcon/default-passive-events) [](https://bundlephobia.com/result?p=default-passive-events) |
| | | |
| | | > Makes {passive: true} by default when EventListenerOptions are supported |
| | | |
| | | 50 lines snippet that enables [passive event listeners](https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md) by default for some events ([see list below](#targeted-events)). It basically will set **{ passive: true }** automatically every time you declare a new [event listener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener). |
| | | |
| | | ## Installation |
| | | |
| | | ```bash |
| | | yarn add default-passive-events |
| | | ``` |
| | | |
| | | ## Usage |
| | | |
| | | Simply require the package: |
| | | |
| | | ```javascript |
| | | require('default-passive-events'); |
| | | ``` |
| | | |
| | | or include it locally: |
| | | |
| | | ```html |
| | | <script type="text/javascript" src="node_modules/default-passive-events/dist/index.js"></script> |
| | | ``` |
| | | |
| | | or from [unpkg](https://unpkg.com/#/) [CDN](https://en.wikipedia.org/wiki/Content_delivery_network): |
| | | |
| | | ```html |
| | | <script type="text/javascript" src="https://unpkg.com/default-passive-events"></script> |
| | | ``` |
| | | |
| | | ## Bundle formats |
| | | |
| | | This package is distributed as multiple, different types of output bundles. The most often your bundler will properly choose the correct version by itself. |
| | | |
| | | To get more information about supported bundle formats have a look at [official `microbundle` documentation](https://github.com/developit/microbundle#-output-formats-). Especially interesting is the `modern` format which - if used properly with your bundle system - might produce significantly smaller output code. |
| | | |
| | | ## Examples |
| | | |
| | | Those are some examples and their output: |
| | | |
| | | ```javascript |
| | | document.addEventListener('mouseup', onMouseUp); // {passive: true, capture: false} |
| | | document.addEventListener('mouseup', onMouseUp, true); // {passive: true, capture: true} |
| | | document.addEventListener('mouseup', onMouseUp, false); // {passive: true, capture: false} |
| | | document.addEventListener('mouseup', onMouseUp, {passive: false}); // {passive: false, capture: false} |
| | | document.addEventListener('mouseup', onMouseUp, {passive: false, capture: false}); // {passive: false, capture: false} |
| | | document.addEventListener('mouseup', onMouseUp, {passive: false, capture: true}); // {passive: false, capture: true} |
| | | document.addEventListener('mouseup', onMouseUp, {passive: true, capture: false}); // {passive: true, capture: false} |
| | | document.addEventListener('mouseup', onMouseUp, {passive: true, capture: true}); // {passive: true, capture: true} |
| | | ``` |
| | | |
| | | ## Demo |
| | | |
| | | Check the [demo page](https://zzarcon.github.io/default-passive-events) for a working example. |
| | | |
| | | ## Motivation |
| | | |
| | | Just to take benefit in your apps without having to edit every single event listener you already have. |
| | | |
| | | ## Targeted events |
| | | |
| | | Default-passive-events package makes following event listeners passive by default: |
| | | |
| | | * scroll |
| | | * wheel |
| | | * touchstart |
| | | * touchmove |
| | | * touchenter |
| | | * touchend |
| | | * touchleave |
| | | * mouseout |
| | | * mouseleave |
| | | * mouseup |
| | | * mousedown |
| | | * mousemove |
| | | * mouseenter |
| | | * mousewheel |
| | | * mouseover |
| | | |
| | | ## Q&A |
| | | |
| | | ### Browser rises weird error when I try to preventDefault event inside of a passive listener. |
| | | |
| | | Well, that's true, partly. First of all specification says that you shouldn't ever try to preventDefault from the context of passive listener. But if that's not a possibility you should know that in the console you see only *error-looking log messages*, which are *not actual errors* (ergo: they *do not break your code*). |
| | | |
| | | ### Is there a possibility to hide these messages? |
| | | |
| | | Unfortunately, no. Since they are not actual errors there is no way to catch them and (more importantly) there is no way to distinguish whether you're inside of the passive listener context to know when not to call/override preventDefault method. Now, we look at the regarding issue in WHATWG repo whatwg/dom#587. |
| | | |
| | | ### Is there a possibility to bring default addEventListener method back for chosen elements/globally (e.g. for time of running some of the code)? |
| | | |
| | | Yes, original addEventListener is available under `_original` property of our's addEventListener's implementation (so - `element.addEventListener._original`). Having that in mind, you can bring it back for however you want, e.g.: |
| | | |
| | | ```javascript |
| | | element.addEventListener = element.addEventListener._original; |
| | | ``` |
| | | |
| | | ## Resources |
| | | |
| | | * About passive event listeners https://medium.com/@devlucky/about-passive-event-listeners-224ff620e68c |
| | | * EventListenerOptions https://github.com/WICG/EventListenerOptions |
| | | * Explanation https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md |
| | | * Polyfill https://github.com/WICG/EventListenerOptions/blob/gh-pages/EventListenerOptions.polyfill.js |
| | | * Spec https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions |
| | | * Chrome feature https://www.chromestatus.com/features#passive |
| | | * About scrolling performance https://plus.google.com/+RickByers/posts/cmzrtyBYPQc |
| | | * Nice Chrome blog article https://blog.chromium.org/2016/05/new-apis-to-help-developers-improve.html |
| | | |
| | | ## Author |
| | | |
| | | [@zzarcon](https://github.com/zzarcon) |
| | | |
| | | ## Maintainers |
| | | |
| | | [@zzarcon](https://github.com/zzarcon) |
| | | [@frsgit](https://github.com/frsgit) |
New file |
| | |
| | | var e,t=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];if(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}()){var o=EventTarget.prototype.addEventListener;e=o,EventTarget.prototype.addEventListener=function(o,r,n){var s,a="object"==typeof n&&null!==n,i=a?n.capture:n;(n=a?function(e){var t=Object.getOwnPropertyDescriptor(e,"passive");return t&&!0!==t.writable&&void 0===t.set?Object.assign({},e):e}(n):{}).passive=void 0!==(s=n.passive)?s:-1!==t.indexOf(o)&&!0,n.capture=void 0!==i&&i,e.call(this,o,r,n)},EventTarget.prototype.addEventListener._original=e} |
| | | //# sourceMappingURL=index.js.map |
New file |
| | |
| | | {"version":3,"file":"index.js","sources":["../src/index.js","../src/utils.js"],"sourcesContent":["import { eventListenerOptionsSupported } from './utils';\n\nconst defaultOptions = {\n passive: true,\n capture: false\n};\nconst supportedPassiveTypes = [\n 'scroll', 'wheel',\n 'touchstart', 'touchmove', 'touchenter', 'touchend', 'touchleave',\n 'mouseout', 'mouseleave', 'mouseup', 'mousedown', 'mousemove', 'mouseenter', 'mousewheel', 'mouseover'\n];\nconst getDefaultPassiveOption = (passive, eventName) => {\n if (passive !== undefined) return passive;\n\n return supportedPassiveTypes.indexOf(eventName) === -1 ? false : defaultOptions.passive;\n};\n\nconst getWritableOptions = (options) => {\n const passiveDescriptor = Object.getOwnPropertyDescriptor(options, 'passive');\n \n return passiveDescriptor && passiveDescriptor.writable !== true && passiveDescriptor.set === undefined\n ? Object.assign({}, options)\n : options;\n};\n\nconst overwriteAddEvent = (superMethod) => {\n EventTarget.prototype.addEventListener = function (type, listener, options) {\n const usesListenerOptions = typeof options === 'object' && options !== null;\n const useCapture = usesListenerOptions ? options.capture : options;\n\n options = usesListenerOptions ? getWritableOptions(options) : {};\n options.passive = getDefaultPassiveOption(options.passive, type);\n options.capture = useCapture === undefined ? defaultOptions.capture : useCapture;\n\n superMethod.call(this, type, listener, options);\n };\n\n EventTarget.prototype.addEventListener._original = superMethod;\n};\n\nconst supportsPassive = eventListenerOptionsSupported();\n\nif (supportsPassive) {\n const addEvent = EventTarget.prototype.addEventListener;\n overwriteAddEvent(addEvent);\n}\n","export const eventListenerOptionsSupported = () => {\n let supported = false;\n\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supported = true;\n }\n });\n\n window.addEventListener('test', null, opts);\n window.removeEventListener('test', null, opts);\n } catch (e) {}\n\n return supported;\n}\n"],"names":["superMethod","supportedPassiveTypes","supported","opts","Object","defineProperty","get","window","addEventListener","removeEventListener","e","eventListenerOptionsSupported","addEvent","EventTarget","prototype","type","listener","options","passive","usesListenerOptions","useCapture","capture","passiveDescriptor","getOwnPropertyDescriptor","writable","undefined","set","assign","getWritableOptions","indexOf","call","this","_original"],"mappings":"IAyB2BA,EAnBrBC,EAAwB,CAC5B,SAAU,QACV,aAAc,YAAa,aAAc,WAAY,aACrD,WAAY,aAAc,UAAW,YAAa,YAAa,aAAc,aAAc,aAiC7F,GC1C6C,WAC3C,IAAIC,GAAY,EAEhB,IACE,IAAMC,EAAOC,OAAOC,eAAe,GAAI,UAAW,CAChDC,eACEJ,GAAY,KAIhBK,OAAOC,iBAAiB,OAAQ,KAAML,GACtCI,OAAOE,oBAAoB,OAAQ,KAAMN,GACzC,MAAOO,IAET,OAAOR,ED0BeS,GAEH,CACnB,IAAMC,EAAWC,YAAYC,UAAUN,iBAlBdR,EAmBPY,EAlBlBC,YAAYC,UAAUN,iBAAmB,SAAUO,EAAMC,EAAUC,GACjE,IAhB6BC,EAgBvBC,EAAyC,iBAAZF,GAAoC,OAAZA,EACrDG,EAAsBD,EAAsBF,EAAQI,QAAUJ,GAEpEA,EAAkBE,EAbK,SAACF,GAC1B,IAAMK,EAAoBlB,OAAOmB,yBAAyBN,EAAS,WAEnE,OAAOK,IAAoD,IAA/BA,EAAkBE,eAA+CC,IAA1BH,EAAkBI,IACjFtB,OAAOuB,OAAO,GAAIV,GAClBA,EAQsCW,CAAmBX,GAAW,IAC9DC,aAnBMO,KADeP,EAoBaD,EAAQC,SAnBlBA,GAEmB,IAA9CjB,EAAsB4B,QAiBgCd,KA5BpD,EA6BPE,EAAQI,aAAyBI,IAAfL,GAAoDA,EAEtEpB,EAAY8B,KAAKC,KAAMhB,EAAMC,EAAUC,IAGzCJ,YAAYC,UAAUN,iBAAiBwB,UAAYhC"} |
New file |
| | |
| | | const e=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];var t;(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})()&&(t=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(o,n,r){const s="object"==typeof r&&null!==r,a=s?r.capture:r;var i;(r=s?(e=>{const t=Object.getOwnPropertyDescriptor(e,"passive");return t&&!0!==t.writable&&void 0===t.set?Object.assign({},e):e})(r):{}).passive=void 0!==(i=r.passive)?i:-1!==e.indexOf(o)&&!0,r.capture=void 0!==a&&a,t.call(this,o,n,r)},EventTarget.prototype.addEventListener._original=t); |
| | | //# sourceMappingURL=index.modern.js.map |
New file |
| | |
| | | {"version":3,"file":"index.modern.js","sources":["../src/index.js","../src/utils.js"],"sourcesContent":["import { eventListenerOptionsSupported } from './utils';\n\nconst defaultOptions = {\n passive: true,\n capture: false\n};\nconst supportedPassiveTypes = [\n 'scroll', 'wheel',\n 'touchstart', 'touchmove', 'touchenter', 'touchend', 'touchleave',\n 'mouseout', 'mouseleave', 'mouseup', 'mousedown', 'mousemove', 'mouseenter', 'mousewheel', 'mouseover'\n];\nconst getDefaultPassiveOption = (passive, eventName) => {\n if (passive !== undefined) return passive;\n\n return supportedPassiveTypes.indexOf(eventName) === -1 ? false : defaultOptions.passive;\n};\n\nconst getWritableOptions = (options) => {\n const passiveDescriptor = Object.getOwnPropertyDescriptor(options, 'passive');\n \n return passiveDescriptor && passiveDescriptor.writable !== true && passiveDescriptor.set === undefined\n ? Object.assign({}, options)\n : options;\n};\n\nconst overwriteAddEvent = (superMethod) => {\n EventTarget.prototype.addEventListener = function (type, listener, options) {\n const usesListenerOptions = typeof options === 'object' && options !== null;\n const useCapture = usesListenerOptions ? options.capture : options;\n\n options = usesListenerOptions ? getWritableOptions(options) : {};\n options.passive = getDefaultPassiveOption(options.passive, type);\n options.capture = useCapture === undefined ? defaultOptions.capture : useCapture;\n\n superMethod.call(this, type, listener, options);\n };\n\n EventTarget.prototype.addEventListener._original = superMethod;\n};\n\nconst supportsPassive = eventListenerOptionsSupported();\n\nif (supportsPassive) {\n const addEvent = EventTarget.prototype.addEventListener;\n overwriteAddEvent(addEvent);\n}\n","export const eventListenerOptionsSupported = () => {\n let supported = false;\n\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supported = true;\n }\n });\n\n window.addEventListener('test', null, opts);\n window.removeEventListener('test', null, opts);\n } catch (e) {}\n\n return supported;\n}\n"],"names":["supportedPassiveTypes","superMethod","supported","opts","Object","defineProperty","get","window","addEventListener","removeEventListener","e","eventListenerOptionsSupported","EventTarget","prototype","type","listener","options","usesListenerOptions","useCapture","capture","passive","passiveDescriptor","getOwnPropertyDescriptor","writable","undefined","set","assign","getWritableOptions","indexOf","call","this","_original"],"mappings":"MAMMA,EAAwB,CAC5B,SAAU,QACV,aAAc,YAAa,aAAc,WAAY,aACrD,WAAY,aAAc,UAAW,YAAa,YAAa,aAAc,aAAc,aAgBlEC,IAAAA,ECzBkB,MAC3C,IAAIC,GAAY,EAEhB,IACE,MAAMC,EAAOC,OAAOC,eAAe,GAAI,UAAW,CAChDC,MACEJ,GAAY,KAIhBK,OAAOC,iBAAiB,OAAQ,KAAML,GACtCI,OAAOE,oBAAoB,OAAQ,KAAMN,GACzC,MAAOO,IAET,OAAOR,GD0BeS,KAfGV,EAkBRW,YAAYC,UAAUL,iBAjBvCI,YAAYC,UAAUL,iBAAmB,SAAUM,EAAMC,EAAUC,GACjE,MAAMC,EAAyC,iBAAZD,GAAoC,OAAZA,EACrDE,EAAsBD,EAAsBD,EAAQG,QAAUH,EAjBxC,IAACI,GAmB7BJ,EAAkBC,EAbMD,CAAAA,IAC1B,MAAMK,EAAoBjB,OAAOkB,yBAAyBN,EAAS,WAEnE,OAAOK,IAAoD,IAA/BA,EAAkBE,eAA+CC,IAA1BH,EAAkBI,IACjFrB,OAAOsB,OAAO,GAAIV,GAClBA,GAQsCW,CAAmBX,GAAW,IAC9DI,aAnBMI,KADeJ,EAoBaJ,EAAQI,SAnBlBA,GAEmB,IAA9CpB,EAAsB4B,QAiBgCd,KA5BpD,EA6BPE,EAAQG,aAAyBK,IAAfN,GAAoDA,EAEtEjB,EAAY4B,KAAKC,KAAMhB,EAAMC,EAAUC,IAGzCJ,YAAYC,UAAUL,iBAAiBuB,UAAY9B"} |
New file |
| | |
| | | var e,t=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];if(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}()){var o=EventTarget.prototype.addEventListener;e=o,EventTarget.prototype.addEventListener=function(o,r,n){var s,a="object"==typeof n&&null!==n,i=a?n.capture:n;(n=a?function(e){var t=Object.getOwnPropertyDescriptor(e,"passive");return t&&!0!==t.writable&&void 0===t.set?Object.assign({},e):e}(n):{}).passive=void 0!==(s=n.passive)?s:-1!==t.indexOf(o)&&!0,n.capture=void 0!==i&&i,e.call(this,o,r,n)},EventTarget.prototype.addEventListener._original=e} |
| | | //# sourceMappingURL=index.module.js.map |
New file |
| | |
| | | {"version":3,"file":"index.module.js","sources":["../src/index.js","../src/utils.js"],"sourcesContent":["import { eventListenerOptionsSupported } from './utils';\n\nconst defaultOptions = {\n passive: true,\n capture: false\n};\nconst supportedPassiveTypes = [\n 'scroll', 'wheel',\n 'touchstart', 'touchmove', 'touchenter', 'touchend', 'touchleave',\n 'mouseout', 'mouseleave', 'mouseup', 'mousedown', 'mousemove', 'mouseenter', 'mousewheel', 'mouseover'\n];\nconst getDefaultPassiveOption = (passive, eventName) => {\n if (passive !== undefined) return passive;\n\n return supportedPassiveTypes.indexOf(eventName) === -1 ? false : defaultOptions.passive;\n};\n\nconst getWritableOptions = (options) => {\n const passiveDescriptor = Object.getOwnPropertyDescriptor(options, 'passive');\n \n return passiveDescriptor && passiveDescriptor.writable !== true && passiveDescriptor.set === undefined\n ? Object.assign({}, options)\n : options;\n};\n\nconst overwriteAddEvent = (superMethod) => {\n EventTarget.prototype.addEventListener = function (type, listener, options) {\n const usesListenerOptions = typeof options === 'object' && options !== null;\n const useCapture = usesListenerOptions ? options.capture : options;\n\n options = usesListenerOptions ? getWritableOptions(options) : {};\n options.passive = getDefaultPassiveOption(options.passive, type);\n options.capture = useCapture === undefined ? defaultOptions.capture : useCapture;\n\n superMethod.call(this, type, listener, options);\n };\n\n EventTarget.prototype.addEventListener._original = superMethod;\n};\n\nconst supportsPassive = eventListenerOptionsSupported();\n\nif (supportsPassive) {\n const addEvent = EventTarget.prototype.addEventListener;\n overwriteAddEvent(addEvent);\n}\n","export const eventListenerOptionsSupported = () => {\n let supported = false;\n\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supported = true;\n }\n });\n\n window.addEventListener('test', null, opts);\n window.removeEventListener('test', null, opts);\n } catch (e) {}\n\n return supported;\n}\n"],"names":["superMethod","supportedPassiveTypes","supported","opts","Object","defineProperty","get","window","addEventListener","removeEventListener","e","eventListenerOptionsSupported","addEvent","EventTarget","prototype","type","listener","options","passive","usesListenerOptions","useCapture","capture","passiveDescriptor","getOwnPropertyDescriptor","writable","undefined","set","assign","getWritableOptions","indexOf","call","this","_original"],"mappings":"IAyB2BA,EAnBrBC,EAAwB,CAC5B,SAAU,QACV,aAAc,YAAa,aAAc,WAAY,aACrD,WAAY,aAAc,UAAW,YAAa,YAAa,aAAc,aAAc,aAiC7F,GC1C6C,WAC3C,IAAIC,GAAY,EAEhB,IACE,IAAMC,EAAOC,OAAOC,eAAe,GAAI,UAAW,CAChDC,eACEJ,GAAY,KAIhBK,OAAOC,iBAAiB,OAAQ,KAAML,GACtCI,OAAOE,oBAAoB,OAAQ,KAAMN,GACzC,MAAOO,IAET,OAAOR,ED0BeS,GAEH,CACnB,IAAMC,EAAWC,YAAYC,UAAUN,iBAlBdR,EAmBPY,EAlBlBC,YAAYC,UAAUN,iBAAmB,SAAUO,EAAMC,EAAUC,GACjE,IAhB6BC,EAgBvBC,EAAyC,iBAAZF,GAAoC,OAAZA,EACrDG,EAAsBD,EAAsBF,EAAQI,QAAUJ,GAEpEA,EAAkBE,EAbK,SAACF,GAC1B,IAAMK,EAAoBlB,OAAOmB,yBAAyBN,EAAS,WAEnE,OAAOK,IAAoD,IAA/BA,EAAkBE,eAA+CC,IAA1BH,EAAkBI,IACjFtB,OAAOuB,OAAO,GAAIV,GAClBA,EAQsCW,CAAmBX,GAAW,IAC9DC,aAnBMO,KADeP,EAoBaD,EAAQC,SAnBlBA,GAEmB,IAA9CjB,EAAsB4B,QAiBgCd,KA5BpD,EA6BPE,EAAQI,aAAyBI,IAAfL,GAAoDA,EAEtEpB,EAAY8B,KAAKC,KAAMhB,EAAMC,EAAUC,IAGzCJ,YAAYC,UAAUN,iBAAiBwB,UAAYhC"} |
New file |
| | |
| | | !function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){var e,t=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];if(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}()){var n=EventTarget.prototype.addEventListener;e=n,EventTarget.prototype.addEventListener=function(n,o,r){var i,s="object"==typeof r&&null!==r,u=s?r.capture:r;(r=s?function(e){var t=Object.getOwnPropertyDescriptor(e,"passive");return t&&!0!==t.writable&&void 0===t.set?Object.assign({},e):e}(r):{}).passive=void 0!==(i=r.passive)?i:-1!==t.indexOf(n)&&!0,r.capture=void 0!==u&&u,e.call(this,n,o,r)},EventTarget.prototype.addEventListener._original=e}}); |
| | | //# sourceMappingURL=index.umd.js.map |
New file |
| | |
| | | {"version":3,"file":"index.umd.js","sources":["../src/index.js","../src/utils.js"],"sourcesContent":["import { eventListenerOptionsSupported } from './utils';\n\nconst defaultOptions = {\n passive: true,\n capture: false\n};\nconst supportedPassiveTypes = [\n 'scroll', 'wheel',\n 'touchstart', 'touchmove', 'touchenter', 'touchend', 'touchleave',\n 'mouseout', 'mouseleave', 'mouseup', 'mousedown', 'mousemove', 'mouseenter', 'mousewheel', 'mouseover'\n];\nconst getDefaultPassiveOption = (passive, eventName) => {\n if (passive !== undefined) return passive;\n\n return supportedPassiveTypes.indexOf(eventName) === -1 ? false : defaultOptions.passive;\n};\n\nconst getWritableOptions = (options) => {\n const passiveDescriptor = Object.getOwnPropertyDescriptor(options, 'passive');\n \n return passiveDescriptor && passiveDescriptor.writable !== true && passiveDescriptor.set === undefined\n ? Object.assign({}, options)\n : options;\n};\n\nconst overwriteAddEvent = (superMethod) => {\n EventTarget.prototype.addEventListener = function (type, listener, options) {\n const usesListenerOptions = typeof options === 'object' && options !== null;\n const useCapture = usesListenerOptions ? options.capture : options;\n\n options = usesListenerOptions ? getWritableOptions(options) : {};\n options.passive = getDefaultPassiveOption(options.passive, type);\n options.capture = useCapture === undefined ? defaultOptions.capture : useCapture;\n\n superMethod.call(this, type, listener, options);\n };\n\n EventTarget.prototype.addEventListener._original = superMethod;\n};\n\nconst supportsPassive = eventListenerOptionsSupported();\n\nif (supportsPassive) {\n const addEvent = EventTarget.prototype.addEventListener;\n overwriteAddEvent(addEvent);\n}\n","export const eventListenerOptionsSupported = () => {\n let supported = false;\n\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supported = true;\n }\n });\n\n window.addEventListener('test', null, opts);\n window.removeEventListener('test', null, opts);\n } catch (e) {}\n\n return supported;\n}\n"],"names":["superMethod","supportedPassiveTypes","supported","opts","Object","defineProperty","get","window","addEventListener","removeEventListener","e","eventListenerOptionsSupported","addEvent","EventTarget","prototype","type","listener","options","passive","usesListenerOptions","useCapture","capture","passiveDescriptor","getOwnPropertyDescriptor","writable","undefined","set","assign","getWritableOptions","indexOf","call","this","_original"],"mappings":"iFAyB2BA,EAnBrBC,EAAwB,CAC5B,SAAU,QACV,aAAc,YAAa,aAAc,WAAY,aACrD,WAAY,aAAc,UAAW,YAAa,YAAa,aAAc,aAAc,aAiC7F,GC1C6C,WAC3C,IAAIC,GAAY,EAEhB,IACE,IAAMC,EAAOC,OAAOC,eAAe,GAAI,UAAW,CAChDC,eACEJ,GAAY,KAIhBK,OAAOC,iBAAiB,OAAQ,KAAML,GACtCI,OAAOE,oBAAoB,OAAQ,KAAMN,GACzC,MAAOO,IAET,OAAOR,ED0BeS,GAEH,CACnB,IAAMC,EAAWC,YAAYC,UAAUN,iBAlBdR,EAmBPY,EAlBlBC,YAAYC,UAAUN,iBAAmB,SAAUO,EAAMC,EAAUC,GACjE,IAhB6BC,EAgBvBC,EAAyC,iBAAZF,GAAoC,OAAZA,EACrDG,EAAsBD,EAAsBF,EAAQI,QAAUJ,GAEpEA,EAAkBE,EAbK,SAACF,GAC1B,IAAMK,EAAoBlB,OAAOmB,yBAAyBN,EAAS,WAEnE,OAAOK,IAAoD,IAA/BA,EAAkBE,eAA+CC,IAA1BH,EAAkBI,IACjFtB,OAAOuB,OAAO,GAAIV,GAClBA,EAQsCW,CAAmBX,GAAW,IAC9DC,aAnBMO,KADeP,EAoBaD,EAAQC,SAnBlBA,GAEmB,IAA9CjB,EAAsB4B,QAiBgCd,KA5BpD,EA6BPE,EAAQI,aAAyBI,IAAfL,GAAoDA,EAEtEpB,EAAY8B,KAAKC,KAAMhB,EAAMC,EAAUC,IAGzCJ,YAAYC,UAAUN,iBAAiBwB,UAAYhC"} |
New file |
| | |
| | | { |
| | | "name": "default-passive-events", |
| | | "version": "2.0.0", |
| | | "description": "Makes {passive: true} by default when EventListenerOptions are supported", |
| | | "main": "dist/index.js", |
| | | "source": "src/index.js", |
| | | "module": "dist/index.module.js", |
| | | "esmodule": "dist/index.modern.js", |
| | | "unpkg": "dist/index.umd.js", |
| | | "scripts": { |
| | | "test": "jest", |
| | | "test-ci": "jest --runInBand --coverage", |
| | | "build": "microbundle", |
| | | "watch": "microbundle watch", |
| | | "prepublishOnly": "yarn test-ci && yarn build", |
| | | "version": "yarn build && git add dist" |
| | | }, |
| | | "repository": { |
| | | "type": "git", |
| | | "url": "git+https://github.com/zzarcon/default-passive-events.git" |
| | | }, |
| | | "author": "zzarcon", |
| | | "contributors": [ |
| | | "FRS <jakub.freisler@gmail.com> (https://github.com/frsgit)" |
| | | ], |
| | | "license": "MIT", |
| | | "bugs": { |
| | | "url": "https://github.com/zzarcon/default-passive-events/issues" |
| | | }, |
| | | "homepage": "https://github.com/zzarcon/default-passive-events#readme", |
| | | "dependencies": {}, |
| | | "devDependencies": { |
| | | "jest": "^26.1.0", |
| | | "microbundle": "^0.12.2" |
| | | }, |
| | | "files": [ |
| | | "dist/", |
| | | "src/", |
| | | "LICENSE", |
| | | "yarn.lock" |
| | | ], |
| | | "jest": { |
| | | "resetMocks": true |
| | | } |
| | | } |
New file |
| | |
| | | import { eventListenerOptionsSupported } from './utils'; |
| | | |
| | | const defaultOptions = { |
| | | passive: true, |
| | | capture: false |
| | | }; |
| | | const supportedPassiveTypes = [ |
| | | 'scroll', 'wheel', |
| | | 'touchstart', 'touchmove', 'touchenter', 'touchend', 'touchleave', |
| | | 'mouseout', 'mouseleave', 'mouseup', 'mousedown', 'mousemove', 'mouseenter', 'mousewheel', 'mouseover' |
| | | ]; |
| | | const getDefaultPassiveOption = (passive, eventName) => { |
| | | if (passive !== undefined) return passive; |
| | | |
| | | return supportedPassiveTypes.indexOf(eventName) === -1 ? false : defaultOptions.passive; |
| | | }; |
| | | |
| | | const getWritableOptions = (options) => { |
| | | const passiveDescriptor = Object.getOwnPropertyDescriptor(options, 'passive'); |
| | | |
| | | return passiveDescriptor && passiveDescriptor.writable !== true && passiveDescriptor.set === undefined |
| | | ? Object.assign({}, options) |
| | | : options; |
| | | }; |
| | | |
| | | const overwriteAddEvent = (superMethod) => { |
| | | EventTarget.prototype.addEventListener = function (type, listener, options) { |
| | | const usesListenerOptions = typeof options === 'object' && options !== null; |
| | | const useCapture = usesListenerOptions ? options.capture : options; |
| | | |
| | | options = usesListenerOptions ? getWritableOptions(options) : {}; |
| | | options.passive = getDefaultPassiveOption(options.passive, type); |
| | | options.capture = useCapture === undefined ? defaultOptions.capture : useCapture; |
| | | |
| | | superMethod.call(this, type, listener, options); |
| | | }; |
| | | |
| | | EventTarget.prototype.addEventListener._original = superMethod; |
| | | }; |
| | | |
| | | const supportsPassive = eventListenerOptionsSupported(); |
| | | |
| | | if (supportsPassive) { |
| | | const addEvent = EventTarget.prototype.addEventListener; |
| | | overwriteAddEvent(addEvent); |
| | | } |
New file |
| | |
| | | export const eventListenerOptionsSupported = () => { |
| | | let supported = false; |
| | | |
| | | try { |
| | | const opts = Object.defineProperty({}, 'passive', { |
| | | get() { |
| | | supported = true; |
| | | } |
| | | }); |
| | | |
| | | window.addEventListener('test', null, opts); |
| | | window.removeEventListener('test', null, opts); |
| | | } catch (e) {} |
| | | |
| | | return supported; |
| | | } |
| | |
| | | import com.example.erp.entity.sd.BasicData; |
| | | import com.example.erp.service.mm.BasicWarehouseTypeService; |
| | | import com.example.erp.service.sd.BasicDateService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(value="仓库基础数据controller",tags={"仓库基础数据操作接口"}) |
| | | @RequestMapping("/BasicWarehouse") |
| | | public class BasicWarehouseTypeController { |
| | | @Autowired |
| | | BasicWarehouseTypeService basicWarehouseTypeService; |
| | | @ApiOperation("基础数据查询返回指定列") |
| | | @GetMapping("/BasicWarehouseType/{type}") |
| | | public Result getBasicWarehouseType(@PathVariable String type){ |
| | | return Result.seccess(basicWarehouseTypeService.getBasicWarehouseType(type)); |
| | | } |
| | | |
| | | @ApiOperation("基础数据查询返回json对象格式") |
| | | @GetMapping("/BasicWarehouseTypes/{type}") |
| | | public Result getBasicWarehouseTypes(@PathVariable String type){ |
| | | return Result.seccess(basicWarehouseTypeService.getBasicWarehouseTypes(type)); |
| | | } |
| | | |
| | | @ApiOperation("基础数据查询") |
| | | @GetMapping("/getBasicWarehouse") |
| | | public Result getBasicWarehouse(){ |
| | | return Result.seccess(basicWarehouseTypeService.getBasicWarehouse()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("基础数据新增") |
| | | @PostMapping("addBasicWarehouse") |
| | | public Result addBasicWarehouse(@RequestBody Map<String,Object> map){ |
| | | return Result.seccess(basicWarehouseTypeService.addBasicWarehouse(map)); |
| | | } |
| | | @ApiOperation("基础数据修改") |
| | | @PostMapping("updateBasicWarehouse") |
| | | public Result updateBasicWarehouse(@RequestBody BasicWarehouseType basicWarehouseType){ |
| | | return Result.seccess(basicWarehouseTypeService.updateBasicWarehouse(basicWarehouseType)); |
| | | } |
| | | |
| | | @ApiOperation("基础数据删除") |
| | | @PostMapping("deleteBasicWarehouse") |
| | | public Result deleteBasicWarehouse(@RequestBody BasicWarehouseType basicWarehouseType){ |
| | | return Result.seccess(basicWarehouseTypeService.deleteBasicWarehouse(basicWarehouseType)); |
| | |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.service.pp.ReplenishService; |
| | | import com.example.erp.service.pp.ReworkService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(value="补片controller",tags={"补片操作接口"}) |
| | | @RequestMapping("/Replenish") |
| | | public class ReplenishController { |
| | | |
| | |
| | | import com.example.erp.entity.sd.OrderDetail; |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.service.pp.ReworkService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(value="返工controller",tags={"返工操作接口"}) |
| | | @RequestMapping("/rework") |
| | | public class ReworkController { |
| | | |