- Finish converting autoNumeric to an ES6 module :
/*
* The idea is to use the AutoNumeric :
* - static methods to access default options and static functions,
* - class to instantiate `AutoNumeric` elements.
/** | |
* Return an array containing only the element 'key => value' that are duplicated in the original $array. | |
* Warning : the generated array DOES NOT respect the order of the original array. | |
* @param $array | |
* | |
* @return array | |
* @licence Copyright (C) 2015 Alexandre Bonneau | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by |
/** | |
* This directive allow the user to 'cancel' an input with the 'Esc' key. | |
* Basically this saves the input value on focus, and set it back to this 'old' value whenever the user hit 'Esc'. | |
* Additionally, if the input value did not change when the user hits 'Esc', then the whole input value is selected. | |
* | |
* @usage <element data-cdz-cancellable contenteditable></element> | |
*/ | |
app.directive('cdzCancellable', function() { | |
return { | |
restrict: 'A', |
directives: { | |
cdzCancellable: { //FIXME finish this | |
bind(el, bindings, vnode, oldVnode) { | |
console.log(`cdzCancellable attached!`, el, el.type, bindings, vnode, oldVnode); //DEBUG | |
if (el.type === 'radio' || el.type === 'checkbox') { | |
return; | |
} | |
let oldValue; | |
let isAutoNumericInput = false; |
//AutoNumeric 2 : https://rawgithub.com/BobKnothe/autoNumeric/master/autoNumeric-2.0/autoNumeric-2.0-BETA.js //FAIL | |
//AutoNumeric 1.9.46 : https://cdnjs.cloudflare.com/ajax/libs/autonumeric/1.9.46/autoNumeric.min.js //WORK | |
//Live example on http://codepen.io/AnotherLinuxUser/pen/VmwvOK | |
let cdzNumericDirective = { | |
//Known problems : | |
//Using __autoNumercic 2.0 BETA__, when using 2 inputs with the same v-model (or when one input updates the value of another, even with different v-models), when you enter a value in one input, both updates well, but when you focus on the second input, the initial value is shown (since the current autoNumeric 2.0 BETA keeps its own `rawValue`). You can solve this by using 1.9.46 for the time being. | |
bind(el, bindings, vnode, oldVnode) { | |
let jQueryElement = $(el); |
.DS_Store | |
node_modules/ | |
# Logs | |
*.log | |
# Test files | |
test/e2e/reports | |
test/e2e/screenshots |
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AutoNumeric=t():e.AutoNumeric=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule", |
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AutoNumeric=t():e.AutoNumeric=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule", |
<!-- | |
v-autonumeric | |
@version 0.2.0 | |
@date 2018-01-31 UTC 22:00 | |
@author Alexandre Bonneau | |
@copyright 2018 © Alexandre Bonneau <[email protected]> | |
@summary A Vue.js component that 'vuetify' the vue-autonumeric one |
{ | |
"name": "tests", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"es6-karma-jasmine-webpack-boilerplate": "^0.2.0", | |
"vue": "^2.5.4", | |
"vue-autonumeric": "^1.0.2" | |
}, |