File tree Expand file tree Collapse file tree 3 files changed +18
-11
lines changed
docs/.vuepress/components Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 6161 :dark =" false"
6262 dense
6363 outlined
64- v-model =" priceUnmasked"
64+ v-model.lazy =" priceUnmasked"
6565 v-number =" config"
6666 />
6767 <div >Model value: <span class =" text-bold" >{{priceUnmasked}}</span ></div >
@@ -95,13 +95,15 @@ export default {
9595 suffix: ' %' ,
9696 precision: 2 ,
9797 null_value: ' ' ,
98- masked: false
98+ masked: false ,
99+ reverseFill: false
99100 },
100101 reverseFill: 6789.10 ,
101102 configReverseFill: {
102103 decimal: ' ,' ,
103104 separator: ' .' ,
104105 prefix: ' $' ,
106+ suffix: ' ' ,
105107 precision: 2 ,
106108 null_value: ' ' ,
107109 reverseFill: true
Original file line number Diff line number Diff line change 11import NumberFormat from './number-format'
2- import options from './options'
2+ // import options from './options'
33
4- export const CONFIG_KEY = '__input-number-format__ '
4+ export const CONFIG_KEY = '__input-facade__ '
55
66/**
77 * Creates a CustomEvent('input') with detail = { facade: true }
@@ -14,15 +14,18 @@ export function FacadeInputEvent() {
1414 detail : { facade : true }
1515 } )
1616}
17-
1817/**
1918 * Transform an array or string config into an object
2019 *
21- * @param {Object } config The mask config object
22- * @param {Object } modifiers An object of modifier flags that can influence the masking process
20+ * @param {object } config The format config object
21+ * @param {object } modifiers An object of modifier flags that can influence the formating process
2322 */
24- export function normalizeConfig ( config ) {
25- return Object . assign ( options , config )
23+ export function normalizeConfig ( config , modifiers ) {
24+ if ( Array . isArray ( config ) || typeof config === 'string' ) {
25+ config = { modifiers : config }
26+ }
27+
28+ return Object . assign ( config || { } , modifiers )
2629}
2730
2831/**
Original file line number Diff line number Diff line change 11import * as core from './core'
2+ import defaults from './options'
23
34const CONFIG_KEY = core . CONFIG_KEY
45
56export default {
67 bind : ( el , { value } , vnode ) => {
78 el = core . getInputElement ( el )
8- const config = core . normalizeConfig ( value )
9+ const config = core . normalizeConfig ( value , value )
910 el [ CONFIG_KEY ] = { config }
1011 // set initial value
1112 core . updateValue ( el , vnode , { force : config . prefill } )
@@ -43,7 +44,8 @@ export default {
4344 update : ( el , { value, oldValue } , vnode ) => {
4445 el = core . getInputElement ( el )
4546 if ( value !== oldValue ) {
46- el [ CONFIG_KEY ] . config = core . normalizeConfig ( value )
47+ const { config } = el [ CONFIG_KEY ]
48+ el [ CONFIG_KEY ] . config = core . normalizeConfig ( config , value )
4749 core . updateValue ( el , vnode , { force : true } )
4850 } else {
4951 core . updateValue ( el , vnode )
You can’t perform that action at this time.
0 commit comments