@sensorskit/vue-on-delete
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -11,3 +11,7 @@ import Vue from 'vue' | ||
) { | ||
import('vconsole').then(result => new result.default()) | ||
import('vconsole').then(result => { | ||
const VConsole = result.default | ||
/* eslint-disable no-new */ | ||
new VConsole() | ||
}) | ||
} | ||
@@ -17,2 +21,3 @@ | ||
/* eslint-disable no-new */ | ||
new Vue({ | ||
@@ -19,0 +24,0 @@ el: '#app', |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.VueOnDelete=n():e.VueOnDelete=n()}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/lib/",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);var r=function(e,n){var t=e.split(""),r=n.split(""),o=null,u=null;if(e===n||e.length<n.length)return!1;if(e.indexOf(n)>=0)return!0;for(var i=0;i<r.length;i++)if(r[i]!==t[i]){o=i;break}for(var l=1;l<=r.length;l++)if(r[r.length-l]!==t[t.length-l]){u=r.length-l;break}return u-o<0};var o={},u=[],i=function(){for(var e,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];(e=console).error.apply(e,["[vue-on-delete]"].concat(function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}(t)))},l=function(e,n,t){return e.addEventListener(n,t,!1),{el:e,destroy:function(){return e.removeEventListener(n,t,!1)}}},f=function(e,n,t){if("function"==typeof n.value){c(e);var o=null,f=null,a=!1;u.push(l(e,"focus",function(){o=e.value}),l(e,"input",function(){a||(f=e.value,r(o,f)&&n.value(),o=f)}),l(e,"compositionstart",function(){a=!0}),l(e,"compositionend",function(){a=!1}))}else i("指令需要传入一个函数!")},c=function(e){if(u.length)for(var n=u.length-1;n>=0;){var t=u[n];t.el===e&&(t.destroy(),u.splice(n,1)),n-=1}},a=function(e,n){n.value!==n.oldValue&&f(e,n)};o.install=function(e,n){var t=n&&n.directive?n.directive:"on-delete";e.directive(t,{bind:f,update:a,unbind:c})};n.default=o}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.VueOnDelete=n():e.VueOnDelete=n()}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/lib/",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);var r=function(e,n){var t=e.split(""),r=n.split(""),o=null,u=null;if(e===n||e.length<n.length)return!1;if(e.indexOf(n)>=0)return!0;for(var i=0;i<r.length;i++)if(r[i]!==t[i]){o=i;break}for(var l=1;l<=r.length;l++)if(r[r.length-l]!==t[t.length-l]){u=r.length-l;break}return u-o<0};var o={},u=[],i=function(){for(var e,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];(e=console).error.apply(e,["[vue-on-delete]"].concat(function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}(t)))},l=function(e,n,t){return e.addEventListener(n,t,!1),{el:e,destroy:function(){return e.removeEventListener(n,t,!1)}}},f=function(e,n,t){if("function"==typeof n.value){c(e);var o=e.value,f=null,a=!1;u.push(l(e,"focus",function(){o=e.value}),l(e,"input",function(){a||(f=e.value,r(o,f)&&n.value(),o=f)}),l(e,"compositionstart",function(){a=!0}),l(e,"compositionend",function(){a=!1}))}else i("指令需要传入一个函数!")},c=function(e){if(u.length)for(var n=u.length-1;n>=0;){var t=u[n];t.el===e&&(t.destroy(),u.splice(n,1)),n-=1}},a=function(e,n){n.value!==n.oldValue&&f(e,n)};o.install=function(e,n){var t=n&&n.directive?n.directive:"on-delete";e.directive(t,{bind:f,update:a,unbind:c})};n.default=o}])}); |
{ | ||
"name": "@sensorskit/vue-on-delete", | ||
"description": "vue custom directive of delete binding", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "newraina <newraina@users.noreply.github.com>", | ||
@@ -17,2 +17,3 @@ "main": "lib/vue-on-delete.js", | ||
"test": "jest", | ||
"lint": "eslint **/*.js", | ||
"commit": "git-cz", | ||
@@ -27,7 +28,3 @@ "precommit": "lint-staged" | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"vue" | ||
], | ||
"moduleFileExtensions": ["js", "json", "vue"], | ||
"transform": { | ||
@@ -37,11 +34,11 @@ ".*\\.(vue)$": "<rootDir>/node_modules/vue-jest", | ||
}, | ||
"setupFiles": [ | ||
"./tool/mock.js" | ||
] | ||
"setupFiles": ["./tool/mock.js"] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"./**/*.js": [ | ||
"yarn prettier", | ||
"git add" | ||
] | ||
"*.{js,json,css,md}": ["prettier --write", "git add"] | ||
}, | ||
@@ -60,2 +57,3 @@ "prettier": { | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.2.2", | ||
"babel-jest": "^22.4.1", | ||
@@ -70,5 +68,12 @@ "babel-loader": "^7.1.2", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"eslint": "^4.19.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.7.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"file-loader": "^1.1.4", | ||
"gh-pages": "^1.1.0", | ||
"html-webpack-plugin": "webpack-contrib/html-webpack-plugin", | ||
"husky": "^0.14.3", | ||
"jest": "^22.4.2", | ||
@@ -75,0 +80,0 @@ "lint-staged": "^7.0.0", |
import isDelete from './isDelete' | ||
const OnDeletePlugin = {} | ||
const noop = () => {} | ||
const registeredHandlers = [] | ||
@@ -30,3 +29,3 @@ | ||
let strOld = null | ||
let strOld = el.value | ||
let strNew = null | ||
@@ -68,3 +67,3 @@ | ||
on(el, 'compositionstart', onCompositionstart), | ||
on(el, 'compositionend', onCompositionend), | ||
on(el, 'compositionend', onCompositionend) | ||
) | ||
@@ -100,3 +99,4 @@ } | ||
OnDeletePlugin.install = function(Vue, options) { | ||
const directiveName = (options && options.directive) ? options.directive : 'on-delete' | ||
const directiveName = | ||
options && options.directive ? options.directive : 'on-delete' | ||
Vue.directive(directiveName, { | ||
@@ -103,0 +103,0 @@ bind, |
@@ -14,3 +14,3 @@ const isDelete = (strOld, strNew) => { | ||
if (arrNew[i] !== arrOld[i]) { | ||
//记录左遍历第一次不相等字符的index | ||
// 记录左遍历第一次不相等字符的index | ||
indexLeft = i | ||
@@ -23,3 +23,3 @@ break | ||
if (arrNew[arrNew.length - i] !== arrOld[arrOld.length - i]) { | ||
//记录右遍历第一次不相等字符的index | ||
// 记录右遍历第一次不相等字符的index | ||
indexRight = arrNew.length - i | ||
@@ -26,0 +26,0 @@ break |
@@ -28,3 +28,2 @@ import { mount, createLocalVue } from '@vue/test-utils' | ||
expect(wrapper.vm.count).toBe(0) | ||
}) | ||
@@ -78,3 +77,2 @@ | ||
test('新值不是旧值的子集 - 左侧增加', () => { | ||
@@ -87,3 +85,2 @@ const before = '12345' | ||
test('新值不是旧值的子集 - 右侧增加', () => { | ||
@@ -90,0 +87,0 @@ const before = '12345' |
@@ -1,14 +0,12 @@ | ||
global.Range = function Range() { | ||
} | ||
global.Range = function Range() {} | ||
const createContextualFragment = str => JSDOM.fragment(str) | ||
Range.prototype.createContextualFragment = (html) => createContextualFragment(html) | ||
Range.prototype.createContextualFragment = html => | ||
createContextualFragment(html) | ||
global.window.createRange = function createRange() { | ||
return { | ||
setEnd: () => { | ||
}, | ||
setStart: () => { | ||
}, | ||
setEnd: () => {}, | ||
setStart: () => {}, | ||
getBoundingClientRect: () => { | ||
@@ -18,4 +16,4 @@ return { right: 0 } | ||
getClientRects: () => [], | ||
createContextualFragment, | ||
createContextualFragment | ||
} | ||
} |
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
327527
23
417
32