vue-convenia-util
Advanced tools
Comparing version 0.4.1 to 0.5.2
@@ -271,11 +271,11 @@ 'use strict'; | ||
* @param {String} date | ||
* @param {Boolean} [toDatabase] Força o formato 'YYYY-MM-DD'. | ||
* @param {{ from: String, to: String }} [options] | ||
* @returns {String} | ||
*/ | ||
var toDate = function (date, toDatabase) { | ||
if ( toDatabase === void 0 ) toDatabase = false; | ||
var toDate = function (date, options) { | ||
if ( options === void 0 ) options = {}; | ||
var from = getDateFormat(date); | ||
var isValid = from ? isDate(date, from) : null; | ||
var to = toDatabase ? 'YYYY-MM-DD' : 'DD/MM/YYYY'; | ||
var from = options.from || getDateFormat(date); | ||
var to = options.to || 'DD/MM/YYYY'; | ||
var isValid = from && isDate(date, from); | ||
var formatted = !isValid ? null : moment(date, from).format(to); | ||
@@ -387,2 +387,33 @@ return formatted | ||
/** | ||
* Adiciona o dado isLoading com true, que assim que o componente é montado e a | ||
* action é executada ele passa a ser false. | ||
* @param {function(Vue): Promise} action | ||
* @returns {{ data: function():{ isLoading: Boolean } mounted: function}} | ||
*/ | ||
var Loadable = function (action) { | ||
var Loadable = { | ||
data: function data () { | ||
return { | ||
isLoading: true | ||
} | ||
}, | ||
mounted: function mounted () { | ||
var this$1 = this; | ||
action || Promise.resolve() | ||
.then(function () { | ||
this$1.isLoading = false; | ||
}); | ||
} | ||
}; | ||
return Loadable | ||
}; | ||
var mixins = Object.freeze({ | ||
Loadable: Loadable | ||
}); | ||
/** | ||
* Integra automaticamente as funções de validação ao vee-validade. | ||
@@ -484,2 +515,3 @@ * @param {vee-validate.Validator} Validator | ||
exports.validate = validate; | ||
exports.mixin = mixins; | ||
exports['default'] = index; |
@@ -265,11 +265,11 @@ import moment from 'moment'; | ||
* @param {String} date | ||
* @param {Boolean} [toDatabase] Força o formato 'YYYY-MM-DD'. | ||
* @param {{ from: String, to: String }} [options] | ||
* @returns {String} | ||
*/ | ||
var toDate = function (date, toDatabase) { | ||
if ( toDatabase === void 0 ) toDatabase = false; | ||
var toDate = function (date, options) { | ||
if ( options === void 0 ) options = {}; | ||
var from = getDateFormat(date); | ||
var isValid = from ? isDate(date, from) : null; | ||
var to = toDatabase ? 'YYYY-MM-DD' : 'DD/MM/YYYY'; | ||
var from = options.from || getDateFormat(date); | ||
var to = options.to || 'DD/MM/YYYY'; | ||
var isValid = from && isDate(date, from); | ||
var formatted = !isValid ? null : moment(date, from).format(to); | ||
@@ -381,2 +381,33 @@ return formatted | ||
/** | ||
* Adiciona o dado isLoading com true, que assim que o componente é montado e a | ||
* action é executada ele passa a ser false. | ||
* @param {function(Vue): Promise} action | ||
* @returns {{ data: function():{ isLoading: Boolean } mounted: function}} | ||
*/ | ||
var Loadable = function (action) { | ||
var Loadable = { | ||
data: function data () { | ||
return { | ||
isLoading: true | ||
} | ||
}, | ||
mounted: function mounted () { | ||
var this$1 = this; | ||
action || Promise.resolve() | ||
.then(function () { | ||
this$1.isLoading = false; | ||
}); | ||
} | ||
}; | ||
return Loadable | ||
}; | ||
var mixins = Object.freeze({ | ||
Loadable: Loadable | ||
}); | ||
/** | ||
* Integra automaticamente as funções de validação ao vee-validade. | ||
@@ -476,2 +507,3 @@ * @param {vee-validate.Validator} Validator | ||
export { $format as format, validate };export default index; | ||
export { $format as format, validate, mixins as mixin }; | ||
export default index; |
{ | ||
"name": "vue-convenia-util", | ||
"version": "0.4.1", | ||
"version": "0.5.2", | ||
"description": "Plugin com validações, formatações e filtros para projetos Vue.", | ||
@@ -32,9 +32,9 @@ "keywords": [ | ||
"ava": "^0.22.0", | ||
"bili": "^0.17.4", | ||
"bili": "^0.18.1", | ||
"moment": "^2.18.1", | ||
"npm-watch": "^0.2.0", | ||
"poi": "^9.2.4", | ||
"sinon": "^3.2.1", | ||
"poi": "^9.3.7", | ||
"sinon": "^3.3.0", | ||
"standard": "^10.0.3", | ||
"vue": "^2.4.2" | ||
"vue": "^2.4.4" | ||
}, | ||
@@ -41,0 +41,0 @@ "peerDependencies": { |
@@ -96,9 +96,9 @@ import moment from 'moment' | ||
* @param {String} date | ||
* @param {Boolean} [toDatabase] Força o formato 'YYYY-MM-DD'. | ||
* @param {{ from: String, to: String }} [options] | ||
* @returns {String} | ||
*/ | ||
export const toDate = (date, toDatabase = false) => { | ||
const from = getDateFormat(date) | ||
const isValid = from ? isDate(date, from) : null | ||
const to = toDatabase ? 'YYYY-MM-DD' : 'DD/MM/YYYY' | ||
export const toDate = (date, options = {}) => { | ||
const from = options.from || getDateFormat(date) | ||
const to = options.to || 'DD/MM/YYYY' | ||
const isValid = from && isDate(date, from) | ||
const formatted = !isValid ? null : moment(date, from).format(to) | ||
@@ -105,0 +105,0 @@ return formatted |
import * as $format from './formatters' | ||
import * as $validate from './validators' | ||
import * as $mixins from './mixins' | ||
import integrations from './integrations' | ||
export { $format as format } | ||
export { $format as format, $validate as validate, $mixins as mixin } | ||
export { $validate as validate } | ||
/** | ||
@@ -10,0 +9,0 @@ * Opções do plugin. |
Sorry, the diff of this file is not supported yet
297723
13
1309