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 61
61
:dark =" false"
62
62
dense
63
63
outlined
64
- v-model =" priceUnmasked"
64
+ v-model.lazy =" priceUnmasked"
65
65
v-number =" config"
66
66
/>
67
67
<div >Model value: <span class =" text-bold" >{{priceUnmasked}}</span ></div >
@@ -95,13 +95,15 @@ export default {
95
95
suffix: ' %' ,
96
96
precision: 2 ,
97
97
null_value: ' ' ,
98
- masked: false
98
+ masked: false ,
99
+ reverseFill: false
99
100
},
100
101
reverseFill: 6789.10 ,
101
102
configReverseFill: {
102
103
decimal: ' ,' ,
103
104
separator: ' .' ,
104
105
prefix: ' $' ,
106
+ suffix: ' ' ,
105
107
precision: 2 ,
106
108
null_value: ' ' ,
107
109
reverseFill: true
Original file line number Diff line number Diff line change 1
1
import NumberFormat from './number-format'
2
- import options from './options'
2
+ // import options from './options'
3
3
4
- export const CONFIG_KEY = '__input-number-format__ '
4
+ export const CONFIG_KEY = '__input-facade__ '
5
5
6
6
/**
7
7
* Creates a CustomEvent('input') with detail = { facade: true }
@@ -14,15 +14,18 @@ export function FacadeInputEvent() {
14
14
detail : { facade : true }
15
15
} )
16
16
}
17
-
18
17
/**
19
18
* Transform an array or string config into an object
20
19
*
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
23
22
*/
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 )
26
29
}
27
30
28
31
/**
Original file line number Diff line number Diff line change 1
1
import * as core from './core'
2
+ import defaults from './options'
2
3
3
4
const CONFIG_KEY = core . CONFIG_KEY
4
5
5
6
export default {
6
7
bind : ( el , { value } , vnode ) => {
7
8
el = core . getInputElement ( el )
8
- const config = core . normalizeConfig ( value )
9
+ const config = core . normalizeConfig ( value , value )
9
10
el [ CONFIG_KEY ] = { config }
10
11
// set initial value
11
12
core . updateValue ( el , vnode , { force : config . prefill } )
@@ -43,7 +44,8 @@ export default {
43
44
update : ( el , { value, oldValue } , vnode ) => {
44
45
el = core . getInputElement ( el )
45
46
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 )
47
49
core . updateValue ( el , vnode , { force : true } )
48
50
} else {
49
51
core . updateValue ( el , vnode )
You can’t perform that action at this time.
0 commit comments