Skip to content

Commit c8c14c7

Browse files
committed
v3.26.0
1 parent 7f10652 commit c8c14c7

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

docs/.vuepress/components/PlayGround.vue

+3-9
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
</div>
2020
<div class="grid">
2121
<div class="font-medium mb-2">Directive</div>
22-
<input
22+
<BaseInput
2323
v-if="updated"
24-
class="shadow-sm rounded-md text-base transition-all disabled:cursor-not-allowed disabled:border-gray-300 disabled:text-gray-300 focus:border-primary focus:ring focus:ring-offset-0 focus:ring-primary focus:ring-opacity-50"
25-
:value="priceDirective"
24+
v-model="priceDirective"
2625
v-number="config"
27-
type="text"
28-
@change="({ target }) => (priceDirective = target.value)"
26+
@change="onChange"
2927
@input="onInput"
3028
@focus="onFocus"
3129
@blur="onBlur"
@@ -169,10 +167,6 @@ export default {
169167
methods: {
170168
onChange() {
171169
console.log('onChange', arguments)
172-
// setTimeout(() => {
173-
// this.price = 1500.629
174-
// this.priceDirective = 1500.629
175-
// }, 3000)
176170
},
177171
onInput() {
178172
console.log('onInput', arguments)

docs/guide/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Get all the essentials features Starting at £0.99/mo<br>
2020
## Installation
2121

2222
::: warning
23-
Install the npm package @coders-tm/vue-number-format@^2.17.0 for Vue 2.0
23+
Install the npm package @coders-tm/vue-number-format@^2.18.0 for Vue 2.0
2424
:::
2525

2626
<CodeGroup>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coders-tm/vue-number-format",
3-
"version": "3.25.0",
3+
"version": "3.26.0",
44
"private": false,
55
"description": "Easy formatted numbers, currency and percentage with input/directive mask for Vue.js",
66
"author": "Dipak Sarkar <[email protected]> (https://dipaksarkar.in/)",

src/core.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ export function updateValue(el: CustomInputElement, vnode: VNode | null, { emit
113113
}
114114

115115
el.oldValue = masked
116-
el.masked = masked
117116
el.unmasked = unmasked
118117

119118
// safari makes the cursor jump to the end if el.value gets assign even if to the same value
@@ -144,8 +143,8 @@ export function inputHandler(event: CustomInputEvent) {
144143
// we can stop propagation of this native event
145144
event.stopPropagation()
146145

147-
const { oldValue, options, masked } = target
148146
let positionFromEnd = target.value.length
147+
const { oldValue, options } = target
149148
if (target.selectionEnd) {
150149
positionFromEnd = target.value.length - target.selectionEnd
151150
}
@@ -163,7 +162,6 @@ export function inputHandler(event: CustomInputEvent) {
163162
updateCursor(target, positionFromEnd)
164163

165164
if (oldValue !== target.value) {
166-
target.oldValue = masked
167165
target.dispatchEvent(InputEvent('input'))
168166
}
169167
}
@@ -179,12 +177,11 @@ export function blurHandler(event: Event) {
179177
return false
180178
}
181179

182-
const { oldValue, masked } = target
180+
const { oldValue } = target
183181

184182
updateValue(target, null, { force: true, emit: false, clean: true })
185183

186184
if (oldValue !== target.value) {
187-
target.oldValue = masked
188185
target.dispatchEvent(InputEvent('change'))
189186
}
190187
}
@@ -196,8 +193,6 @@ export function keydownHandler(event: KeyboardEvent, el: CustomInputElement) {
196193
const { options } = el
197194
const { prefix, suffix, decimal, min, separator } = options as Options
198195
const { key } = event
199-
200-
console.log(key)
201196
const regExp = new RegExp(`${prefix}|${suffix}`, 'g')
202197
const newValue = el.value.replace(regExp, '')
203198
const canNegativeInput = min === undefined || Number(min) < 0 || Number(min) !== min

0 commit comments

Comments
 (0)