@robin-rossow/vue-input-number 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue");function j(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
5
|
-
*/var O=Object.getOwnPropertySymbols,
|
|
5
|
+
*/var O=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;function A(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function T(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var n=Object.getOwnPropertyNames(t).map(function(u){return t[u]});if(n.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(u){o[u]=u}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var F=T()?Object.assign:function(r,t){for(var e,n=A(r),o,u=1;u<arguments.length;u++){e=Object(arguments[u]);for(var c in e)I.call(e,c)&&(n[c]=e[c]);if(O){o=O(e);for(var s=0;s<o.length;s++)M.call(e,o[s])&&(n[o[s]]=e[o[s]])}}return n};const S=j(F);var k=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),n=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;t[e]=o;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var u=Object.getOwnPropertySymbols(t);if(u.length!==1||u[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(t,e);if(c.value!==o||c.enumerable!==!0)return!1}return!0},x=k,$=function(){return x()&&!!Symbol.toStringTag},C=String.prototype.valueOf,D=function(t){try{return C.call(t),!0}catch{return!1}},B=Object.prototype.toString,U="[object String]",q=$(),H=function(t){return typeof t=="string"?!0:typeof t!="object"?!1:q?D(t):B.call(t)===U};const R=j(H);function Z(r){return R(r)&&r.match("%v")?{pos:r,neg:r.replace("-","").replace("%v","-%v"),zero:r}:r}const f={symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3,stripZeros:!1,fallback:0};function z(r,t){const e=r.split(t),n=e[0],o=e[1].replace(/0+$/,"");return o.length>0?n+t+o:n}function G(r,t){return r=Math.round(Math.abs(r)),isNaN(r)?t:r}function d(r,t){t=G(t,f.precision);const e=Math.pow(10,t);return(Math.round((r+1e-8)*e)/e).toFixed(t)}function N(r,t={}){if(Array.isArray(r))return r.map(c=>N(c,t));t=S({},f,t);const e=r<0?"-":"",n=parseInt(d(Math.abs(r),t.precision),10)+"",o=n.length>3?n.length%3:0,u=e+(o?n.substr(0,o)+t.thousand:"")+n.substr(o).replace(/(\d{3})(?=\d)/g,"$1"+t.thousand)+(t.precision>0?t.decimal+d(Math.abs(r),t.precision).split(".")[1]:"");return t.stripZeros?z(u,t.decimal):u}function h(r,t={}){if(Array.isArray(r))return r.map(o=>h(o,t));t=S({},f,t);const e=Z(t.format);let n;return r>0?n=e.pos:r<0?n=e.neg:n=e.zero,n.replace("%s",t.symbol).replace("%v",N(Math.abs(r),t))}function w(r,t=f.decimal,e=f.fallback){if(Array.isArray(r))return r.map(p=>w(p,t,e));if(typeof r=="number")return r;const n=new RegExp("[^0-9-(-)-"+t+"]",["g"]),o=(""+r).replace(n,"").replace(t,".").replace(/\(([-]*\d*[^)]?\d+)\)/g,"-$1").replace(/\((.*)\)/,""),u=(o.match(/-/g)||2).length%2,c=parseFloat(o.replace(/-/g,"")),s=c*(u?-1:1);return isNaN(s)?e:s}const L=["value"],P=i.defineComponent({__name:"VueInputNumber",props:{modelValue:{},outputType:{default:"Number"},min:{default:Number.MIN_SAFE_INTEGER},max:{default:Number.MAX_SAFE_INTEGER},precision:{default:0},thousandSeparator:{default:","},decimalSeparator:{default:"."},currency:{default:""},currencySymbolPosition:{default:"prefix"},emptyValue:{default:""}},emits:["update:modelValue","blur","focus"],setup(r,{emit:t}){const e=r,n=i.ref(""),o=i.ref(!1),u=i.ref(),c=i.computed(()=>v(n.value)),s=i.computed(()=>v(e.modelValue)),p=i.computed(()=>e.currency?e.currencySymbolPosition==="suffix"?"%v %s":"%s %v":"%v");m(s.value),n.value=b(s.value),i.watch(e,()=>{o.value||(m(s.value),n.value=b(s.value))});function _(a){o.value=!1,t("blur",a),n.value=b(s.value)}function V(a){if(o.value=!0,t("focus",a),typeof s.value=="string"&&s.value==="")return"";n.value=h(s.value,{symbol:"",format:"%v",thousand:"",decimal:e.decimalSeparator,precision:Number(e.precision)})}function E(){m(c.value)}function m(a){if(typeof a=="string"&&a==="")t("update:modelValue",a);else{if(a=Number(a),a>=e.max){y(e.max);return}if(a<=e.min){y(e.min);return}if(a>e.min&&a<e.max){y(a);return}}}function y(a){const l=d(a,e.precision),g=e.outputType.toLowerCase()==="string"?l:Number(l);t("update:modelValue",g)}function b(a){return typeof a=="string"&&a===""?"":h(a,{symbol:e.currency,format:p.value,precision:Number(e.precision),decimal:e.decimalSeparator,thousand:e.thousandSeparator})}function v(a){const l=typeof a=="string"&&a===""?e.emptyValue:a;return typeof l=="string"&&l===""?"":w(l,e.decimalSeparator)}return(a,l)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",i.mergeProps(a.$attrs,{ref_key:"inputElement",ref:u,"onUpdate:modelValue":l[0]||(l[0]=g=>n.value=g),value:n.value,onBlur:_,onInput:E,onFocus:V}),null,16,L)),[[i.vModelDynamic,n.value]])}}),X={install:r=>{r.component("VueInputNumber",P)}};exports.VueInputNumber=P;exports.default=X;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
function
|
|
1
|
+
import { defineComponent as I, ref as g, computed as d, watch as M, withDirectives as A, openBlock as F, createElementBlock as T, mergeProps as k, vModelDynamic as x } from "vue";
|
|
2
|
+
function S(t) {
|
|
3
3
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4
4
|
}
|
|
5
5
|
/*
|
|
@@ -7,13 +7,13 @@ object-assign
|
|
|
7
7
|
(c) Sindre Sorhus
|
|
8
8
|
@license MIT
|
|
9
9
|
*/
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var j = Object.getOwnPropertySymbols, $ = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
function D(t) {
|
|
12
12
|
if (t == null)
|
|
13
13
|
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
14
14
|
return Object(t);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function B() {
|
|
17
17
|
try {
|
|
18
18
|
if (!Object.assign)
|
|
19
19
|
return !1;
|
|
@@ -22,76 +22,76 @@ function z() {
|
|
|
22
22
|
return !1;
|
|
23
23
|
for (var r = {}, e = 0; e < 10; e++)
|
|
24
24
|
r["_" + String.fromCharCode(e)] = e;
|
|
25
|
-
var
|
|
26
|
-
return r[
|
|
25
|
+
var n = Object.getOwnPropertyNames(r).map(function(u) {
|
|
26
|
+
return r[u];
|
|
27
27
|
});
|
|
28
|
-
if (
|
|
28
|
+
if (n.join("") !== "0123456789")
|
|
29
29
|
return !1;
|
|
30
|
-
var
|
|
31
|
-
return "abcdefghijklmnopqrst".split("").forEach(function(
|
|
32
|
-
|
|
33
|
-
}), Object.keys(Object.assign({},
|
|
30
|
+
var o = {};
|
|
31
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(u) {
|
|
32
|
+
o[u] = u;
|
|
33
|
+
}), Object.keys(Object.assign({}, o)).join("") === "abcdefghijklmnopqrst";
|
|
34
34
|
} catch {
|
|
35
35
|
return !1;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
for (var e,
|
|
40
|
-
e = Object(arguments[
|
|
41
|
-
for (var
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
for (var
|
|
46
|
-
|
|
38
|
+
var U = B() ? Object.assign : function(t, r) {
|
|
39
|
+
for (var e, n = D(t), o, u = 1; u < arguments.length; u++) {
|
|
40
|
+
e = Object(arguments[u]);
|
|
41
|
+
for (var i in e)
|
|
42
|
+
$.call(e, i) && (n[i] = e[i]);
|
|
43
|
+
if (j) {
|
|
44
|
+
o = j(e);
|
|
45
|
+
for (var s = 0; s < o.length; s++)
|
|
46
|
+
C.call(e, o[s]) && (n[o[s]] = e[o[s]]);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
return
|
|
49
|
+
return n;
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
var
|
|
51
|
+
const N = /* @__PURE__ */ S(U);
|
|
52
|
+
var H = function() {
|
|
53
53
|
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
|
|
54
54
|
return !1;
|
|
55
55
|
if (typeof Symbol.iterator == "symbol")
|
|
56
56
|
return !0;
|
|
57
|
-
var r = {}, e = Symbol("test"),
|
|
58
|
-
if (typeof e == "string" || Object.prototype.toString.call(e) !== "[object Symbol]" || Object.prototype.toString.call(
|
|
57
|
+
var r = {}, e = Symbol("test"), n = Object(e);
|
|
58
|
+
if (typeof e == "string" || Object.prototype.toString.call(e) !== "[object Symbol]" || Object.prototype.toString.call(n) !== "[object Symbol]")
|
|
59
59
|
return !1;
|
|
60
|
-
var
|
|
61
|
-
r[e] =
|
|
60
|
+
var o = 42;
|
|
61
|
+
r[e] = o;
|
|
62
62
|
for (e in r)
|
|
63
63
|
return !1;
|
|
64
64
|
if (typeof Object.keys == "function" && Object.keys(r).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(r).length !== 0)
|
|
65
65
|
return !1;
|
|
66
|
-
var
|
|
67
|
-
if (
|
|
66
|
+
var u = Object.getOwnPropertySymbols(r);
|
|
67
|
+
if (u.length !== 1 || u[0] !== e || !Object.prototype.propertyIsEnumerable.call(r, e))
|
|
68
68
|
return !1;
|
|
69
69
|
if (typeof Object.getOwnPropertyDescriptor == "function") {
|
|
70
|
-
var
|
|
71
|
-
if (
|
|
70
|
+
var i = Object.getOwnPropertyDescriptor(r, e);
|
|
71
|
+
if (i.value !== o || i.enumerable !== !0)
|
|
72
72
|
return !1;
|
|
73
73
|
}
|
|
74
74
|
return !0;
|
|
75
|
-
},
|
|
76
|
-
return
|
|
77
|
-
},
|
|
75
|
+
}, R = H, Z = function() {
|
|
76
|
+
return R() && !!Symbol.toStringTag;
|
|
77
|
+
}, q = String.prototype.valueOf, z = function(r) {
|
|
78
78
|
try {
|
|
79
|
-
return
|
|
79
|
+
return q.call(r), !0;
|
|
80
80
|
} catch {
|
|
81
81
|
return !1;
|
|
82
82
|
}
|
|
83
|
-
},
|
|
84
|
-
return typeof r == "string" ? !0 : typeof r != "object" ? !1 :
|
|
83
|
+
}, G = Object.prototype.toString, L = "[object String]", X = Z(), J = function(r) {
|
|
84
|
+
return typeof r == "string" ? !0 : typeof r != "object" ? !1 : X ? z(r) : G.call(r) === L;
|
|
85
85
|
};
|
|
86
|
-
const
|
|
87
|
-
function
|
|
88
|
-
return
|
|
86
|
+
const K = /* @__PURE__ */ S(J);
|
|
87
|
+
function Q(t) {
|
|
88
|
+
return K(t) && t.match("%v") ? {
|
|
89
89
|
pos: t,
|
|
90
90
|
neg: t.replace("-", "").replace("%v", "-%v"),
|
|
91
91
|
zero: t
|
|
92
92
|
} : t;
|
|
93
93
|
}
|
|
94
|
-
const
|
|
94
|
+
const l = {
|
|
95
95
|
symbol: "$",
|
|
96
96
|
// default currency symbol is '$'
|
|
97
97
|
format: "%s%v",
|
|
@@ -109,145 +109,139 @@ const p = {
|
|
|
109
109
|
fallback: 0
|
|
110
110
|
// value returned on unformat() failure
|
|
111
111
|
};
|
|
112
|
-
function
|
|
113
|
-
const e = t.split(r),
|
|
114
|
-
return
|
|
112
|
+
function W(t, r) {
|
|
113
|
+
const e = t.split(r), n = e[0], o = e[1].replace(/0+$/, "");
|
|
114
|
+
return o.length > 0 ? n + r + o : n;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Y(t, r) {
|
|
117
117
|
return t = Math.round(Math.abs(t)), isNaN(t) ? r : t;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
r =
|
|
119
|
+
function h(t, r) {
|
|
120
|
+
r = Y(r, l.precision);
|
|
121
121
|
const e = Math.pow(10, r);
|
|
122
122
|
return (Math.round((t + 1e-8) * e) / e).toFixed(r);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function w(t, r = {}) {
|
|
125
125
|
if (Array.isArray(t))
|
|
126
|
-
return t.map((
|
|
127
|
-
r =
|
|
126
|
+
return t.map((i) => w(i, r));
|
|
127
|
+
r = N(
|
|
128
128
|
{},
|
|
129
|
-
|
|
129
|
+
l,
|
|
130
130
|
r
|
|
131
131
|
);
|
|
132
|
-
const e = t < 0 ? "-" : "",
|
|
133
|
-
return r.stripZeros ?
|
|
132
|
+
const e = t < 0 ? "-" : "", n = parseInt(h(Math.abs(t), r.precision), 10) + "", o = n.length > 3 ? n.length % 3 : 0, u = e + (o ? n.substr(0, o) + r.thousand : "") + n.substr(o).replace(/(\d{3})(?=\d)/g, "$1" + r.thousand) + (r.precision > 0 ? r.decimal + h(Math.abs(t), r.precision).split(".")[1] : "");
|
|
133
|
+
return r.stripZeros ? W(u, r.decimal) : u;
|
|
134
134
|
}
|
|
135
135
|
function v(t, r = {}) {
|
|
136
136
|
if (Array.isArray(t))
|
|
137
|
-
return t.map((
|
|
138
|
-
r =
|
|
137
|
+
return t.map((o) => v(o, r));
|
|
138
|
+
r = N(
|
|
139
139
|
{},
|
|
140
|
-
|
|
140
|
+
l,
|
|
141
141
|
r
|
|
142
142
|
);
|
|
143
|
-
const e =
|
|
144
|
-
let
|
|
145
|
-
return t > 0 ?
|
|
143
|
+
const e = Q(r.format);
|
|
144
|
+
let n;
|
|
145
|
+
return t > 0 ? n = e.pos : t < 0 ? n = e.neg : n = e.zero, n.replace("%s", r.symbol).replace("%v", w(Math.abs(t), r));
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function P(t, r = l.decimal, e = l.fallback) {
|
|
148
148
|
if (Array.isArray(t))
|
|
149
|
-
return t.map((
|
|
149
|
+
return t.map((f) => P(f, r, e));
|
|
150
150
|
if (typeof t == "number")
|
|
151
151
|
return t;
|
|
152
|
-
const
|
|
153
|
-
return isNaN(
|
|
152
|
+
const n = new RegExp("[^0-9-(-)-" + r + "]", ["g"]), o = ("" + t).replace(n, "").replace(r, ".").replace(/\(([-]*\d*[^)]?\d+)\)/g, "-$1").replace(/\((.*)\)/, ""), u = (o.match(/-/g) || 2).length % 2, i = parseFloat(o.replace(/-/g, "")), s = i * (u ? -1 : 1);
|
|
153
|
+
return isNaN(s) ? e : s;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
155
|
+
const ee = ["value"], re = /* @__PURE__ */ I({
|
|
156
156
|
__name: "VueInputNumber",
|
|
157
157
|
props: {
|
|
158
158
|
modelValue: {},
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
outputType: { default: "Number" },
|
|
160
|
+
min: { default: Number.MIN_SAFE_INTEGER },
|
|
161
161
|
max: { default: Number.MAX_SAFE_INTEGER },
|
|
162
|
-
min: { default: Number.MAX_SAFE_INTEGER },
|
|
163
|
-
minus: { type: Boolean, default: !1 },
|
|
164
|
-
placeholder: { default: "" },
|
|
165
|
-
emptyValue: { default: "" },
|
|
166
162
|
precision: { default: 0 },
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
readOnlyClass: { default: "" },
|
|
173
|
-
disabled: { type: Boolean, default: !1 },
|
|
174
|
-
currencySymbolPosition: { default: "prefix" }
|
|
163
|
+
thousandSeparator: { default: "," },
|
|
164
|
+
decimalSeparator: { default: "." },
|
|
165
|
+
currency: { default: "" },
|
|
166
|
+
currencySymbolPosition: { default: "prefix" },
|
|
167
|
+
emptyValue: { default: "" }
|
|
175
168
|
},
|
|
176
|
-
emits: ["update:modelValue", "
|
|
169
|
+
emits: ["update:modelValue", "blur", "focus"],
|
|
177
170
|
setup(t, { emit: r }) {
|
|
178
|
-
const e = t,
|
|
179
|
-
(
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
function
|
|
183
|
-
r("
|
|
184
|
-
}
|
|
185
|
-
function M(n) {
|
|
186
|
-
r("blur", n), a.value = y(u.value);
|
|
171
|
+
const e = t, n = g(""), o = g(!1), u = g(), i = d(() => O(n.value)), s = d(() => O(e.modelValue)), f = d(() => e.currency ? e.currencySymbolPosition === "suffix" ? "%v %s" : "%s %v" : "%v");
|
|
172
|
+
p(s.value), n.value = y(s.value), M(e, () => {
|
|
173
|
+
o.value || (p(s.value), n.value = y(s.value));
|
|
174
|
+
});
|
|
175
|
+
function V(a) {
|
|
176
|
+
o.value = !1, r("blur", a), n.value = y(s.value);
|
|
187
177
|
}
|
|
188
|
-
function
|
|
189
|
-
if (r("focus",
|
|
178
|
+
function E(a) {
|
|
179
|
+
if (o.value = !0, r("focus", a), typeof s.value == "string" && s.value === "")
|
|
190
180
|
return "";
|
|
191
|
-
|
|
181
|
+
n.value = v(s.value, {
|
|
192
182
|
symbol: "",
|
|
193
183
|
format: "%v",
|
|
194
184
|
thousand: "",
|
|
195
|
-
decimal:
|
|
185
|
+
decimal: e.decimalSeparator,
|
|
196
186
|
precision: Number(e.precision)
|
|
197
187
|
});
|
|
198
188
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
189
|
+
function _() {
|
|
190
|
+
p(i.value);
|
|
201
191
|
}
|
|
202
|
-
function
|
|
203
|
-
typeof
|
|
192
|
+
function p(a) {
|
|
193
|
+
if (typeof a == "string" && a === "")
|
|
194
|
+
r("update:modelValue", a);
|
|
195
|
+
else {
|
|
196
|
+
if (a = Number(a), a >= e.max) {
|
|
197
|
+
m(e.max);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (a <= e.min) {
|
|
201
|
+
m(e.min);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (a > e.min && a < e.max) {
|
|
205
|
+
m(a);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
204
209
|
}
|
|
205
|
-
function
|
|
206
|
-
const
|
|
210
|
+
function m(a) {
|
|
211
|
+
const c = h(a, e.precision), b = e.outputType.toLowerCase() === "string" ? c : Number(c);
|
|
207
212
|
r("update:modelValue", b);
|
|
208
213
|
}
|
|
209
|
-
function y(
|
|
210
|
-
return typeof
|
|
214
|
+
function y(a) {
|
|
215
|
+
return typeof a == "string" && a === "" ? "" : v(a, {
|
|
211
216
|
symbol: e.currency,
|
|
212
|
-
format:
|
|
217
|
+
format: f.value,
|
|
213
218
|
precision: Number(e.precision),
|
|
214
|
-
decimal:
|
|
215
|
-
thousand:
|
|
219
|
+
decimal: e.decimalSeparator,
|
|
220
|
+
thousand: e.thousandSeparator
|
|
216
221
|
});
|
|
217
222
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
220
|
-
return typeof
|
|
221
|
-
}
|
|
222
|
-
function T() {
|
|
223
|
-
return u.value === 0 && o.value !== "";
|
|
223
|
+
function O(a) {
|
|
224
|
+
const c = typeof a == "string" && a === "" ? e.emptyValue : a;
|
|
225
|
+
return typeof c == "string" && c === "" ? "" : P(c, e.decimalSeparator);
|
|
224
226
|
}
|
|
225
|
-
return (
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}, null, 40, oe)), [
|
|
237
|
-
[$, o.value]
|
|
238
|
-
]),
|
|
239
|
-
n.readOnly ? (g(), h("span", {
|
|
240
|
-
key: 1,
|
|
241
|
-
class: x({ readOnlyClass: n.readOnlyClass })
|
|
242
|
-
}, H(a.value), 3)) : j("", !0)
|
|
243
|
-
], 64));
|
|
227
|
+
return (a, c) => A((F(), T("input", k(a.$attrs, {
|
|
228
|
+
ref_key: "inputElement",
|
|
229
|
+
ref: u,
|
|
230
|
+
"onUpdate:modelValue": c[0] || (c[0] = (b) => n.value = b),
|
|
231
|
+
value: n.value,
|
|
232
|
+
onBlur: V,
|
|
233
|
+
onInput: _,
|
|
234
|
+
onFocus: E
|
|
235
|
+
}), null, 16, ee)), [
|
|
236
|
+
[x, n.value]
|
|
237
|
+
]);
|
|
244
238
|
}
|
|
245
|
-
}),
|
|
239
|
+
}), ne = {
|
|
246
240
|
install: (t) => {
|
|
247
|
-
t.component("VueInputNumber",
|
|
241
|
+
t.component("VueInputNumber", re);
|
|
248
242
|
}
|
|
249
243
|
};
|
|
250
244
|
export {
|
|
251
|
-
|
|
252
|
-
|
|
245
|
+
re as VueInputNumber,
|
|
246
|
+
ne as default
|
|
253
247
|
};
|
|
@@ -1,214 +1,129 @@
|
|
|
1
1
|
import type { PropType as __PropType } from 'vue';
|
|
2
2
|
export interface Props {
|
|
3
3
|
modelValue: string | number;
|
|
4
|
-
|
|
5
|
-
currency?: string;
|
|
6
|
-
max?: number;
|
|
4
|
+
outputType?: 'Number' | 'String';
|
|
7
5
|
min?: number;
|
|
8
|
-
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
emptyValue?: number | string;
|
|
6
|
+
max?: number;
|
|
11
7
|
precision?: number;
|
|
12
|
-
separator?: string;
|
|
13
8
|
thousandSeparator?: string | undefined;
|
|
14
9
|
decimalSeparator?: string | undefined;
|
|
15
|
-
|
|
16
|
-
readOnly?: boolean;
|
|
17
|
-
readOnlyClass?: string;
|
|
18
|
-
disabled?: boolean;
|
|
10
|
+
currency?: string;
|
|
19
11
|
currencySymbolPosition?: 'prefix' | 'suffix';
|
|
12
|
+
emptyValue?: number | '';
|
|
20
13
|
}
|
|
21
14
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
22
15
|
modelValue: {
|
|
23
16
|
type: __PropType<string | number>;
|
|
24
17
|
required: true;
|
|
25
18
|
};
|
|
26
|
-
|
|
27
|
-
type: __PropType<
|
|
28
|
-
required: false;
|
|
29
|
-
default: boolean;
|
|
30
|
-
};
|
|
31
|
-
currency: {
|
|
32
|
-
type: __PropType<string>;
|
|
19
|
+
outputType: {
|
|
20
|
+
type: __PropType<"Number" | "String">;
|
|
33
21
|
required: false;
|
|
34
22
|
default: string;
|
|
35
23
|
};
|
|
36
|
-
|
|
24
|
+
min: {
|
|
37
25
|
type: __PropType<number>;
|
|
38
26
|
required: false;
|
|
39
27
|
default: number;
|
|
40
28
|
};
|
|
41
|
-
|
|
29
|
+
max: {
|
|
42
30
|
type: __PropType<number>;
|
|
43
31
|
required: false;
|
|
44
32
|
default: number;
|
|
45
33
|
};
|
|
46
|
-
minus: {
|
|
47
|
-
type: __PropType<boolean>;
|
|
48
|
-
required: false;
|
|
49
|
-
default: boolean;
|
|
50
|
-
};
|
|
51
|
-
placeholder: {
|
|
52
|
-
type: __PropType<string>;
|
|
53
|
-
required: false;
|
|
54
|
-
default: string;
|
|
55
|
-
};
|
|
56
|
-
emptyValue: {
|
|
57
|
-
type: __PropType<string | number>;
|
|
58
|
-
required: false;
|
|
59
|
-
default: string;
|
|
60
|
-
};
|
|
61
34
|
precision: {
|
|
62
35
|
type: __PropType<number>;
|
|
63
36
|
required: false;
|
|
64
37
|
default: number;
|
|
65
38
|
};
|
|
66
|
-
separator: {
|
|
67
|
-
type: __PropType<string>;
|
|
68
|
-
required: false;
|
|
69
|
-
default: string;
|
|
70
|
-
};
|
|
71
39
|
thousandSeparator: {
|
|
72
40
|
type: __PropType<string>;
|
|
73
41
|
required: false;
|
|
74
|
-
default:
|
|
42
|
+
default: string;
|
|
75
43
|
};
|
|
76
44
|
decimalSeparator: {
|
|
77
45
|
type: __PropType<string>;
|
|
78
46
|
required: false;
|
|
79
|
-
default: any;
|
|
80
|
-
};
|
|
81
|
-
outputType: {
|
|
82
|
-
type: __PropType<"Number" | "String">;
|
|
83
|
-
required: true;
|
|
84
47
|
default: string;
|
|
85
48
|
};
|
|
86
|
-
|
|
87
|
-
type: __PropType<boolean>;
|
|
88
|
-
required: false;
|
|
89
|
-
default: boolean;
|
|
90
|
-
};
|
|
91
|
-
readOnlyClass: {
|
|
49
|
+
currency: {
|
|
92
50
|
type: __PropType<string>;
|
|
93
51
|
required: false;
|
|
94
52
|
default: string;
|
|
95
53
|
};
|
|
96
|
-
disabled: {
|
|
97
|
-
type: __PropType<boolean>;
|
|
98
|
-
required: false;
|
|
99
|
-
default: boolean;
|
|
100
|
-
};
|
|
101
54
|
currencySymbolPosition: {
|
|
102
55
|
type: __PropType<"prefix" | "suffix">;
|
|
103
56
|
required: false;
|
|
104
57
|
default: string;
|
|
105
58
|
};
|
|
106
|
-
|
|
59
|
+
emptyValue: {
|
|
60
|
+
type: __PropType<number | "">;
|
|
61
|
+
required: false;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "blur" | "focus")[], "update:modelValue" | "blur" | "focus", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
107
65
|
modelValue: {
|
|
108
66
|
type: __PropType<string | number>;
|
|
109
67
|
required: true;
|
|
110
68
|
};
|
|
111
|
-
|
|
112
|
-
type: __PropType<
|
|
113
|
-
required: false;
|
|
114
|
-
default: boolean;
|
|
115
|
-
};
|
|
116
|
-
currency: {
|
|
117
|
-
type: __PropType<string>;
|
|
69
|
+
outputType: {
|
|
70
|
+
type: __PropType<"Number" | "String">;
|
|
118
71
|
required: false;
|
|
119
72
|
default: string;
|
|
120
73
|
};
|
|
121
|
-
|
|
74
|
+
min: {
|
|
122
75
|
type: __PropType<number>;
|
|
123
76
|
required: false;
|
|
124
77
|
default: number;
|
|
125
78
|
};
|
|
126
|
-
|
|
79
|
+
max: {
|
|
127
80
|
type: __PropType<number>;
|
|
128
81
|
required: false;
|
|
129
82
|
default: number;
|
|
130
83
|
};
|
|
131
|
-
minus: {
|
|
132
|
-
type: __PropType<boolean>;
|
|
133
|
-
required: false;
|
|
134
|
-
default: boolean;
|
|
135
|
-
};
|
|
136
|
-
placeholder: {
|
|
137
|
-
type: __PropType<string>;
|
|
138
|
-
required: false;
|
|
139
|
-
default: string;
|
|
140
|
-
};
|
|
141
|
-
emptyValue: {
|
|
142
|
-
type: __PropType<string | number>;
|
|
143
|
-
required: false;
|
|
144
|
-
default: string;
|
|
145
|
-
};
|
|
146
84
|
precision: {
|
|
147
85
|
type: __PropType<number>;
|
|
148
86
|
required: false;
|
|
149
87
|
default: number;
|
|
150
88
|
};
|
|
151
|
-
separator: {
|
|
152
|
-
type: __PropType<string>;
|
|
153
|
-
required: false;
|
|
154
|
-
default: string;
|
|
155
|
-
};
|
|
156
89
|
thousandSeparator: {
|
|
157
90
|
type: __PropType<string>;
|
|
158
91
|
required: false;
|
|
159
|
-
default:
|
|
92
|
+
default: string;
|
|
160
93
|
};
|
|
161
94
|
decimalSeparator: {
|
|
162
95
|
type: __PropType<string>;
|
|
163
96
|
required: false;
|
|
164
|
-
default: any;
|
|
165
|
-
};
|
|
166
|
-
outputType: {
|
|
167
|
-
type: __PropType<"Number" | "String">;
|
|
168
|
-
required: true;
|
|
169
97
|
default: string;
|
|
170
98
|
};
|
|
171
|
-
|
|
172
|
-
type: __PropType<boolean>;
|
|
173
|
-
required: false;
|
|
174
|
-
default: boolean;
|
|
175
|
-
};
|
|
176
|
-
readOnlyClass: {
|
|
99
|
+
currency: {
|
|
177
100
|
type: __PropType<string>;
|
|
178
101
|
required: false;
|
|
179
102
|
default: string;
|
|
180
103
|
};
|
|
181
|
-
disabled: {
|
|
182
|
-
type: __PropType<boolean>;
|
|
183
|
-
required: false;
|
|
184
|
-
default: boolean;
|
|
185
|
-
};
|
|
186
104
|
currencySymbolPosition: {
|
|
187
105
|
type: __PropType<"prefix" | "suffix">;
|
|
188
106
|
required: false;
|
|
189
107
|
default: string;
|
|
190
108
|
};
|
|
109
|
+
emptyValue: {
|
|
110
|
+
type: __PropType<number | "">;
|
|
111
|
+
required: false;
|
|
112
|
+
default: string;
|
|
113
|
+
};
|
|
191
114
|
}>> & {
|
|
192
115
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
193
|
-
onChange?: (...args: any[]) => any;
|
|
194
116
|
onBlur?: (...args: any[]) => any;
|
|
195
117
|
onFocus?: (...args: any[]) => any;
|
|
196
118
|
}, {
|
|
197
|
-
|
|
198
|
-
currency: string;
|
|
199
|
-
max: number;
|
|
119
|
+
outputType: "Number" | "String";
|
|
200
120
|
min: number;
|
|
201
|
-
|
|
202
|
-
placeholder: string;
|
|
203
|
-
emptyValue: string | number;
|
|
121
|
+
max: number;
|
|
204
122
|
precision: number;
|
|
205
|
-
separator: string;
|
|
206
123
|
thousandSeparator: string;
|
|
207
124
|
decimalSeparator: string;
|
|
208
|
-
|
|
209
|
-
readOnly: boolean;
|
|
210
|
-
readOnlyClass: string;
|
|
211
|
-
disabled: boolean;
|
|
125
|
+
currency: string;
|
|
212
126
|
currencySymbolPosition: "prefix" | "suffix";
|
|
127
|
+
emptyValue: number | "";
|
|
213
128
|
}, {}>;
|
|
214
129
|
export default _sfc_main;
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robin-rossow/vue-input-number",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js"
|
|
8
8
|
},
|
|
9
|
+
"types": "./dist/VueInputNumberPlugin.d.ts",
|
|
9
10
|
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/robinrossow/vue-input-number"
|
|
14
|
+
},
|
|
10
15
|
"files": [
|
|
11
16
|
"dist"
|
|
12
17
|
],
|
|
File without changes
|