@kizmann/nano-ui 0.8.30 → 0.8.31
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -118,7 +118,7 @@ export default {
|
|
118
118
|
modelValue(value)
|
119
119
|
{
|
120
120
|
if ( value !== this.tempValue ) {
|
121
|
-
this.tempValue =
|
121
|
+
this.tempValue = this.getValue(value);
|
122
122
|
}
|
123
123
|
}
|
124
124
|
|
@@ -127,7 +127,7 @@ export default {
|
|
127
127
|
data()
|
128
128
|
{
|
129
129
|
return {
|
130
|
-
focus: false, tempValue:
|
130
|
+
focus: false, tempValue: this.getValue(),
|
131
131
|
}
|
132
132
|
},
|
133
133
|
|
@@ -135,12 +135,26 @@ export default {
|
|
135
135
|
|
136
136
|
clear()
|
137
137
|
{
|
138
|
-
this.$emit('update:modelValue', this.clearValue);
|
138
|
+
this.$emit('update:modelValue', this.tempValue = this.clearValue);
|
139
|
+
},
|
140
|
+
|
141
|
+
getValue(value = null)
|
142
|
+
{
|
143
|
+
if ( Any.isNull(value) ) {
|
144
|
+
value = this.modelValue;
|
145
|
+
}
|
146
|
+
|
147
|
+
if ( Any.isEmpty(value) ) {
|
148
|
+
return this.min;
|
149
|
+
}
|
150
|
+
|
151
|
+
return Num.float(value);
|
139
152
|
},
|
140
153
|
|
141
154
|
getDisplayValue()
|
142
155
|
{
|
143
|
-
|
156
|
+
|
157
|
+
if ( Any.isEmpty(this.modelValue) ) {
|
144
158
|
return null;
|
145
159
|
}
|
146
160
|
|
@@ -251,6 +265,10 @@ export default {
|
|
251
265
|
{
|
252
266
|
let value = event.target.value;
|
253
267
|
|
268
|
+
if ( value.match(/^[0-9]+((.|,)[0-9]+)?$/) ) {
|
269
|
+
value = this.format.replace(':count', value);
|
270
|
+
}
|
271
|
+
|
254
272
|
let format = this.format.replace(':count',
|
255
273
|
`([0-9\\,\\.\\-\\s]+)`);
|
256
274
|
|
@@ -258,7 +276,7 @@ export default {
|
|
258
276
|
|
259
277
|
let match = value.match(regex);
|
260
278
|
|
261
|
-
if ( !
|
279
|
+
if ( !match ) {
|
262
280
|
return event.target.value = this.getDisplayValue();
|
263
281
|
}
|
264
282
|
|
@@ -289,12 +307,12 @@ export default {
|
|
289
307
|
this.tempValue <= this.min;
|
290
308
|
|
291
309
|
let props = {
|
292
|
-
type:
|
293
|
-
size:
|
294
|
-
icon:
|
295
|
-
square:
|
296
|
-
disabled:
|
297
|
-
onMousedown:
|
310
|
+
type: 'input-number',
|
311
|
+
size: this.size,
|
312
|
+
icon: 'fa fa-minus',
|
313
|
+
square: true,
|
314
|
+
disabled: disabled,
|
315
|
+
onMousedown: this.onPrevDown,
|
298
316
|
};
|
299
317
|
|
300
318
|
return (<NButton {...props} />);
|
@@ -306,12 +324,12 @@ export default {
|
|
306
324
|
this.tempValue >= this.max;
|
307
325
|
|
308
326
|
let props = {
|
309
|
-
type:
|
310
|
-
size:
|
311
|
-
icon:
|
312
|
-
square:
|
313
|
-
disabled:
|
314
|
-
onMousedown:
|
327
|
+
type: 'input-number',
|
328
|
+
size: this.size,
|
329
|
+
icon: 'fa fa-plus',
|
330
|
+
square: true,
|
331
|
+
disabled: disabled,
|
332
|
+
onMousedown: this.onNextDown,
|
315
333
|
};
|
316
334
|
|
317
335
|
return (<NButton {...props} />);
|
@@ -323,29 +341,26 @@ export default {
|
|
323
341
|
['class', 'style']);
|
324
342
|
|
325
343
|
Obj.assign(props, {
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
344
|
+
value: this.getDisplayValue(),
|
345
|
+
disabled: this.disabled,
|
346
|
+
placeholder: this.placeholder,
|
347
|
+
onKeydown: this.onKeydown,
|
348
|
+
onFocus: this.onFocus,
|
349
|
+
onBlur: this.onBlur,
|
331
350
|
});
|
332
351
|
|
333
|
-
if ( this.modelValue !== null ) {
|
334
|
-
props.value = this.getDisplayValue();
|
335
|
-
}
|
336
|
-
|
337
352
|
return h('input', props);
|
338
353
|
},
|
339
354
|
|
340
355
|
renderClear()
|
341
356
|
{
|
342
|
-
if ( !
|
357
|
+
if ( !this.clearable || Any.isEmpty(this.tempValue) ) {
|
343
358
|
return null;
|
344
359
|
}
|
345
360
|
|
346
361
|
let props = {};
|
347
362
|
|
348
|
-
if ( !
|
363
|
+
if ( !this.disabled ) {
|
349
364
|
props.onMousedown = this.clear;
|
350
365
|
}
|
351
366
|
|
@@ -382,10 +397,10 @@ export default {
|
|
382
397
|
|
383
398
|
return (
|
384
399
|
<div class={classList}>
|
385
|
-
{
|
386
|
-
{
|
387
|
-
{
|
388
|
-
{
|
400
|
+
{this.ctor('renderPrev')()}
|
401
|
+
{this.ctor('renderInput')()}
|
402
|
+
{this.ctor('renderClear')()}
|
403
|
+
{this.ctor('renderNext')()}
|
389
404
|
</div>
|
390
405
|
);
|
391
406
|
}
|
@@ -90,11 +90,12 @@ export default {
|
|
90
90
|
data()
|
91
91
|
{
|
92
92
|
return {
|
93
|
-
tempPage: this.page,
|
94
|
-
|
95
|
-
}
|
93
|
+
tempPage: this.page, tempLimit: this.limit,
|
94
|
+
};
|
96
95
|
},
|
97
96
|
|
97
|
+
|
98
|
+
|
98
99
|
methods: {
|
99
100
|
|
100
101
|
forcePage(page)
|
@@ -142,12 +143,12 @@ export default {
|
|
142
143
|
|
143
144
|
onLimitInput(value)
|
144
145
|
{
|
145
|
-
|
146
|
-
|
147
|
-
if ( this.pages < this.tempPage ) {
|
146
|
+
if ( this.tempLimit !== value ) {
|
148
147
|
this.$emit('update:page', this.tempPage = 1);
|
149
148
|
}
|
150
149
|
|
150
|
+
this.$emit('update:limit', this.tempLimit = value);
|
151
|
+
|
151
152
|
this.updatePaginate();
|
152
153
|
},
|
153
154
|
|