@kizmann/nano-ui 0.8.27 → 0.8.29
Sign up to get free protection for your applications and to get access to all the features.
- package/demos/grid.html +1 -1
- package/demos/overview.html +1 -1
- package/demos/scrollbar.html +1 -1
- package/demos/tabs.html +1 -1
- package/dist/nano-ui.css +1 -1
- package/dist/nano-ui.js +2 -2
- package/dist/nano-ui.js.map +1 -1
- package/package.json +1 -1
- package/servy.json +6 -0
- package/src/config/src/config/config-next.js +16 -10
- package/src/preview/src/preview-image/preview-image.js +10 -1
- package/src/scrollbar/src/scrollbar/scrollbar.next.js +68 -48
- package/src/scrollbar/src/scrollbar/scrollbar.scss +10 -2
- package/src/timepicker/src/timepicker-panel/timepicker-panel.js +44 -24
- package/src/virtualscroller/src/virtualscroller/virtualscroller.beta.js +11 -9
package/package.json
CHANGED
package/servy.json
ADDED
@@ -279,27 +279,33 @@ export default {
|
|
279
279
|
value.fallback);
|
280
280
|
});
|
281
281
|
|
282
|
-
let
|
282
|
+
let component = alias.replace(/:.*?$/, '');
|
283
283
|
|
284
|
-
|
285
|
-
|
286
|
-
try {
|
287
|
-
component = resolveComponent(element);
|
288
|
-
} catch (e) {
|
289
|
-
component = element;
|
284
|
+
if ( !Arr.has(['div', 'p'], component) ) {
|
285
|
+
component = resolveComponent(component);
|
290
286
|
}
|
291
287
|
|
292
288
|
if ( Any.isEmpty(component) ) {
|
293
289
|
return null;
|
294
290
|
}
|
295
291
|
|
296
|
-
if ( !
|
292
|
+
if ( !this.propExists(setup['vShow']) ) {
|
297
293
|
props.style = "display: none;";
|
298
294
|
}
|
299
295
|
|
300
|
-
|
301
|
-
return
|
296
|
+
let render = () => Arr.each(setup.content, (value, key) => {
|
297
|
+
return this.ctor('renderSetup')(value, key)
|
302
298
|
});
|
299
|
+
|
300
|
+
if ( Any.isFunction(setup.content) ) {
|
301
|
+
render = setup.content.apply(this.scope);
|
302
|
+
}
|
303
|
+
|
304
|
+
if ( Any.isString(setup.content) ) {
|
305
|
+
render = setup.content;
|
306
|
+
}
|
307
|
+
|
308
|
+
return h(component, props, render);
|
303
309
|
},
|
304
310
|
|
305
311
|
render()
|
@@ -27,6 +27,11 @@ export default {
|
|
27
27
|
if ( ! window.ImageCache ) {
|
28
28
|
window.ImageCache = [];
|
29
29
|
}
|
30
|
+
|
31
|
+
|
32
|
+
if ( ! Arr.has(window.ImageCache, this.src) ) {
|
33
|
+
this.tempSrc = this.src;
|
34
|
+
}
|
30
35
|
},
|
31
36
|
|
32
37
|
mounted()
|
@@ -46,6 +51,10 @@ export default {
|
|
46
51
|
|
47
52
|
resolveLoad()
|
48
53
|
{
|
54
|
+
if ( ! Arr.has(window.ImageCache, this.src) ) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
|
49
58
|
this.tempSrc = null;
|
50
59
|
|
51
60
|
if ( Any.isObject(this.src) ) {
|
@@ -65,7 +74,7 @@ export default {
|
|
65
74
|
Any.delay(() => this.load = false, 200);
|
66
75
|
});
|
67
76
|
|
68
|
-
this.
|
77
|
+
this.laod = true;
|
69
78
|
},
|
70
79
|
|
71
80
|
resolveData()
|
@@ -97,7 +97,7 @@ export default {
|
|
97
97
|
computed: {
|
98
98
|
|
99
99
|
touch() {
|
100
|
-
return !! ('ontouchstart' in window ||
|
100
|
+
return !! ('ontouchstart' in window ||
|
101
101
|
navigator.msMaxTouchPoints);
|
102
102
|
},
|
103
103
|
|
@@ -145,10 +145,10 @@ export default {
|
|
145
145
|
Event.bind('NResizer:moved',
|
146
146
|
this.onUpdate, this._.uid);
|
147
147
|
|
148
|
-
Dom.find(window).on('resize',
|
148
|
+
Dom.find(window).on('resize',
|
149
149
|
this.onResize, passive);
|
150
|
-
|
151
|
-
Dom.find(this.$refs.content).on('scroll',
|
150
|
+
|
151
|
+
Dom.find(this.$refs.content).on('scroll',
|
152
152
|
this.onScroll, passive);
|
153
153
|
},
|
154
154
|
|
@@ -168,16 +168,16 @@ export default {
|
|
168
168
|
passive: true, uid: this._.uid
|
169
169
|
};
|
170
170
|
|
171
|
-
Event.unbind('NScrollbar:resize',
|
171
|
+
Event.unbind('NScrollbar:resize',
|
172
172
|
this._.uid);
|
173
173
|
|
174
|
-
Event.unbind('NResizer:moved',
|
174
|
+
Event.unbind('NResizer:moved',
|
175
175
|
this._.uid);
|
176
176
|
|
177
|
-
Dom.find(window).off('resize',
|
177
|
+
Dom.find(window).off('resize',
|
178
178
|
null, passive);
|
179
179
|
|
180
|
-
Dom.find(this.$el).off('scroll',
|
180
|
+
Dom.find(this.$el).off('scroll',
|
181
181
|
null, passive);
|
182
182
|
},
|
183
183
|
|
@@ -253,7 +253,7 @@ export default {
|
|
253
253
|
|
254
254
|
adaptScrollHeight()
|
255
255
|
{
|
256
|
-
if ( this.native ) {
|
256
|
+
if ( this.native && this.allowNative ) {
|
257
257
|
return;
|
258
258
|
}
|
259
259
|
|
@@ -264,7 +264,11 @@ export default {
|
|
264
264
|
// this.$refs.content.offsetWidth;
|
265
265
|
|
266
266
|
let outerHeight = this.$refs.content.
|
267
|
-
clientHeight|| 0;
|
267
|
+
clientHeight || 0;
|
268
|
+
|
269
|
+
if ( this.native && ! this.allowNative ) {
|
270
|
+
outerHeight -= 16;
|
271
|
+
}
|
268
272
|
|
269
273
|
// if ( offsetHeight === 0 && this.overflowX ) {
|
270
274
|
// outerHeight -= 15;
|
@@ -273,11 +277,15 @@ export default {
|
|
273
277
|
let innerHeight = this.$refs.content
|
274
278
|
.scrollHeight || 0;
|
275
279
|
|
280
|
+
if ( this.native && ! this.allowNative ) {
|
281
|
+
innerHeight -= 16;
|
282
|
+
}
|
283
|
+
|
276
284
|
// if ( offsetHeight === 0 && this.overflowX ) {
|
277
285
|
// innerHeight -= 15;
|
278
286
|
// }
|
279
287
|
|
280
|
-
let isSameOld = outerHeight === this.outerHeight &&
|
288
|
+
let isSameOld = outerHeight === this.outerHeight &&
|
281
289
|
innerHeight === this.innerHeight;
|
282
290
|
|
283
291
|
if ( isSameOld ) {
|
@@ -287,15 +295,15 @@ export default {
|
|
287
295
|
this.outerHeight = outerHeight;
|
288
296
|
this.innerHeight = innerHeight;
|
289
297
|
|
290
|
-
let height = (outerHeight / innerHeight)
|
298
|
+
let height = (outerHeight / innerHeight)
|
291
299
|
* outerHeight;
|
292
300
|
|
293
301
|
let barHeight = Math.max(height, 50);
|
294
302
|
|
295
|
-
let maxHeight = Math.ceil((outerHeight / innerHeight) *
|
303
|
+
let maxHeight = Math.ceil((outerHeight / innerHeight) *
|
296
304
|
(innerHeight - outerHeight));
|
297
|
-
|
298
|
-
this.heightRatio = (maxHeight - (barHeight - height)
|
305
|
+
|
306
|
+
this.heightRatio = (maxHeight - (barHeight - height)
|
299
307
|
- this.offsetY) / maxHeight;
|
300
308
|
|
301
309
|
Dom.find(this.$refs.vbar).css({
|
@@ -331,7 +339,7 @@ export default {
|
|
331
339
|
|
332
340
|
adaptScrollWidth()
|
333
341
|
{
|
334
|
-
if ( this.native ) {
|
342
|
+
if ( this.native && this.allowNative ) {
|
335
343
|
return;
|
336
344
|
}
|
337
345
|
|
@@ -343,7 +351,11 @@ export default {
|
|
343
351
|
|
344
352
|
let outerWidth = this.$refs.content.
|
345
353
|
clientWidth || 0;
|
346
|
-
|
354
|
+
|
355
|
+
if ( this.native && ! this.allowNative ) {
|
356
|
+
outerWidth -= 16;
|
357
|
+
}
|
358
|
+
|
347
359
|
// if ( offsetWidth === 0 && this.overflowY ) {
|
348
360
|
// outerWidth -= 15;
|
349
361
|
// }
|
@@ -351,11 +363,15 @@ export default {
|
|
351
363
|
let innerWidth = this.$refs.content
|
352
364
|
.scrollWidth || 0;
|
353
365
|
|
366
|
+
if ( this.native && ! this.allowNative ) {
|
367
|
+
innerWidth -= 16;
|
368
|
+
}
|
369
|
+
|
354
370
|
// if ( offsetWidth === 0 && this.overflowY ) {
|
355
371
|
// innerWidth -= 15;
|
356
372
|
// }
|
357
373
|
|
358
|
-
let isSameOld = outerWidth === this.outerWidth &&
|
374
|
+
let isSameOld = outerWidth === this.outerWidth &&
|
359
375
|
innerWidth === this.innerWidth;
|
360
376
|
|
361
377
|
if ( isSameOld ) {
|
@@ -365,15 +381,15 @@ export default {
|
|
365
381
|
this.outerWidth = outerWidth;
|
366
382
|
this.innerWidth = innerWidth;
|
367
383
|
|
368
|
-
let width = (outerWidth / innerWidth)
|
384
|
+
let width = (outerWidth / innerWidth)
|
369
385
|
* outerWidth;
|
370
386
|
|
371
387
|
let barWidth = Math.max(width, 50);
|
372
388
|
|
373
|
-
let maxWidth = Math.ceil((outerWidth / innerWidth) *
|
389
|
+
let maxWidth = Math.ceil((outerWidth / innerWidth) *
|
374
390
|
(innerWidth - outerWidth));
|
375
|
-
|
376
|
-
this.widthRatio = (maxWidth - (barWidth - width)
|
391
|
+
|
392
|
+
this.widthRatio = (maxWidth - (barWidth - width)
|
377
393
|
- this.offsetX) / maxWidth;
|
378
394
|
|
379
395
|
Dom.find(this.$refs.hbar).css({
|
@@ -381,7 +397,7 @@ export default {
|
|
381
397
|
});
|
382
398
|
|
383
399
|
// let hasNativeBar = offsetHeight && this.overflowX;
|
384
|
-
|
400
|
+
|
385
401
|
// if ( hasNativeBar ) {
|
386
402
|
// Dom.find(this.$el).addClass('has-native-hbar');
|
387
403
|
// }
|
@@ -409,7 +425,7 @@ export default {
|
|
409
425
|
|
410
426
|
adaptScrollPosition(scroll = {})
|
411
427
|
{
|
412
|
-
if ( this.native ) {
|
428
|
+
if ( this.native && this.allowNative ) {
|
413
429
|
return;
|
414
430
|
}
|
415
431
|
|
@@ -421,7 +437,7 @@ export default {
|
|
421
437
|
scroll.left = this.$refs.content.scrollLeft;
|
422
438
|
}
|
423
439
|
|
424
|
-
let vbarTop= Math.ceil((this.outerHeight / this.innerHeight) *
|
440
|
+
let vbarTop= Math.ceil((this.outerHeight / this.innerHeight) *
|
425
441
|
scroll.top * this.heightRatio) || 0;
|
426
442
|
|
427
443
|
if ( ! this.vbarTop || vbarTop !== this.vbarTop ) {
|
@@ -433,7 +449,7 @@ export default {
|
|
433
449
|
this.vbarTop = vbarTop;
|
434
450
|
}
|
435
451
|
|
436
|
-
let hbarLeft = Math.ceil((this.outerWidth / this.innerWidth) *
|
452
|
+
let hbarLeft = Math.ceil((this.outerWidth / this.innerWidth) *
|
437
453
|
scroll.left * this.widthRatio) || 0;
|
438
454
|
|
439
455
|
if ( ! this.hbarLeft || hbarLeft !== this.hbarLeft ) {
|
@@ -441,7 +457,7 @@ export default {
|
|
441
457
|
Dom.find(this.$refs.hbar).css({
|
442
458
|
transform: `translateX(${hbarLeft}px) translateZ(0)`
|
443
459
|
});
|
444
|
-
|
460
|
+
|
445
461
|
this.hbarLeft = hbarLeft;
|
446
462
|
}
|
447
463
|
},
|
@@ -489,7 +505,7 @@ export default {
|
|
489
505
|
|
490
506
|
bindAdaptHeight()
|
491
507
|
{
|
492
|
-
this.refreshHeight = setInterval(this.adaptHeight,
|
508
|
+
this.refreshHeight = setInterval(this.adaptHeight,
|
493
509
|
1000 / this.framerate);
|
494
510
|
},
|
495
511
|
|
@@ -539,7 +555,7 @@ export default {
|
|
539
555
|
|
540
556
|
bindAdaptWidth()
|
541
557
|
{
|
542
|
-
this.refreshWidth = setInterval(this.adaptWidth,
|
558
|
+
this.refreshWidth = setInterval(this.adaptWidth,
|
543
559
|
1000 / this.framerate);
|
544
560
|
},
|
545
561
|
|
@@ -558,7 +574,7 @@ export default {
|
|
558
574
|
let scrollUpdate = () => {
|
559
575
|
this.$emit('scrollupdate', scroll.top, scroll.left);
|
560
576
|
}
|
561
|
-
|
577
|
+
|
562
578
|
this.$nextTick(scrollUpdate);
|
563
579
|
this.adaptScrollPosition(scroll);
|
564
580
|
},
|
@@ -592,7 +608,7 @@ export default {
|
|
592
608
|
|
593
609
|
this.resizeTimer = setTimeout(
|
594
610
|
this.onUpdate, 500);
|
595
|
-
|
611
|
+
|
596
612
|
Dom.find(this.$el).fire('resized');
|
597
613
|
},
|
598
614
|
|
@@ -641,10 +657,10 @@ export default {
|
|
641
657
|
|
642
658
|
event.stopPropagation();
|
643
659
|
|
644
|
-
Dom.find(document).on(this.mousemove,
|
660
|
+
Dom.find(document).on(this.mousemove,
|
645
661
|
this.onVbarMousemove, this._.uid);
|
646
662
|
|
647
|
-
Dom.find(document).on(this.mouseup,
|
663
|
+
Dom.find(document).on(this.mouseup,
|
648
664
|
this.onVbarMouseup, this._.uid);
|
649
665
|
|
650
666
|
this.scrollTop = this.$refs.content
|
@@ -659,24 +675,24 @@ export default {
|
|
659
675
|
let clientY = this.getTouchEvent(event)
|
660
676
|
.clientY;
|
661
677
|
|
662
|
-
let top = (this.outerHeight / this.innerHeight) *
|
678
|
+
let top = (this.outerHeight / this.innerHeight) *
|
663
679
|
this.scrollTop * this.heightRatio;
|
664
680
|
|
665
681
|
let offset = (clientY - this.clientY) + top;
|
666
682
|
|
667
|
-
let height = (this.outerHeight -
|
668
|
-
|
683
|
+
let height = (this.outerHeight -
|
684
|
+
this.barHeight - this.offsetY);
|
669
685
|
|
670
|
-
this.$refs.content.scrollTop = offset / height *
|
686
|
+
this.$refs.content.scrollTop = offset / height *
|
671
687
|
(this.innerHeight - this.outerHeight);
|
672
688
|
},
|
673
689
|
|
674
690
|
onVbarMouseup(event)
|
675
691
|
{
|
676
|
-
Dom.find(document).off(this.mousemove,
|
692
|
+
Dom.find(document).off(this.mousemove,
|
677
693
|
null, this._.uid);
|
678
694
|
|
679
|
-
Dom.find(document).off(this.mouseup,
|
695
|
+
Dom.find(document).off(this.mouseup,
|
680
696
|
null, this._.uid);
|
681
697
|
},
|
682
698
|
|
@@ -685,13 +701,13 @@ export default {
|
|
685
701
|
if ( ! Arr.has([0, 1], event.which) ) {
|
686
702
|
return;
|
687
703
|
}
|
688
|
-
|
704
|
+
|
689
705
|
event.stopPropagation();
|
690
706
|
|
691
|
-
Dom.find(document).on(this.mousemove,
|
707
|
+
Dom.find(document).on(this.mousemove,
|
692
708
|
this.onHbarMousemove, this._.uid);
|
693
709
|
|
694
|
-
Dom.find(document).on(this.mouseup,
|
710
|
+
Dom.find(document).on(this.mouseup,
|
695
711
|
this.onHbarMouseup, this._.uid);
|
696
712
|
|
697
713
|
this.scrollLeft = this.$refs.content
|
@@ -702,24 +718,24 @@ export default {
|
|
702
718
|
|
703
719
|
onHbarMousemove(event)
|
704
720
|
{
|
705
|
-
let top = (this.outerWidth / this.innerWidth) *
|
721
|
+
let top = (this.outerWidth / this.innerWidth) *
|
706
722
|
this.scrollLeft * this.widthRatio;
|
707
723
|
|
708
724
|
let offset = (event.clientX - this.clientX) + top;
|
709
725
|
|
710
|
-
let width = (this.outerWidth -
|
711
|
-
|
726
|
+
let width = (this.outerWidth -
|
727
|
+
this.barWidth - this.offsetX);
|
712
728
|
|
713
|
-
this.$refs.content.scrollLeft = offset / width *
|
729
|
+
this.$refs.content.scrollLeft = offset / width *
|
714
730
|
(this.innerWidth - this.outerWidth);
|
715
731
|
},
|
716
732
|
|
717
733
|
onHbarMouseup(event)
|
718
734
|
{
|
719
|
-
Dom.find(document).off(this.mousemove,
|
735
|
+
Dom.find(document).off(this.mousemove,
|
720
736
|
null, this._.uid);
|
721
737
|
|
722
|
-
Dom.find(document).off(this.mouseup,
|
738
|
+
Dom.find(document).off(this.mouseup,
|
723
739
|
null, this._.uid);
|
724
740
|
}
|
725
741
|
|
@@ -735,6 +751,10 @@ export default {
|
|
735
751
|
classList.push('n-scrollbar--native');
|
736
752
|
}
|
737
753
|
|
754
|
+
if ( ! this.allowNative ) {
|
755
|
+
classList.push('n-scrollbar--forced');
|
756
|
+
}
|
757
|
+
|
738
758
|
if ( this.touch ) {
|
739
759
|
classList.push('n-scrollbar--touch');
|
740
760
|
}
|
@@ -38,6 +38,13 @@
|
|
38
38
|
bottom: -17px;
|
39
39
|
}
|
40
40
|
|
41
|
+
.n-scrollbar.n-scrollbar--forced.n-scrollbar--native > .n-scrollbar-content {
|
42
|
+
padding-right: 16px;
|
43
|
+
padding-bottom: 16px;
|
44
|
+
right: -16px;
|
45
|
+
bottom: -16px;
|
46
|
+
}
|
47
|
+
|
41
48
|
.n-scrollbar:not(.n-overflow-x) > .n-scrollbar-content {
|
42
49
|
bottom: 0;
|
43
50
|
overflow-x: hidden;
|
@@ -66,15 +73,16 @@
|
|
66
73
|
width: 10px;
|
67
74
|
}
|
68
75
|
|
76
|
+
|
69
77
|
.n-scrollbar-h {
|
70
78
|
left: 0;
|
71
79
|
bottom: 0;
|
72
80
|
height: 10px;
|
73
81
|
}
|
74
82
|
|
75
|
-
.n-scrollbar--native > .n-scrollbar-v,
|
83
|
+
.n-scrollbar--native:not(.n-scrollbar--forced) > .n-scrollbar-v,
|
76
84
|
.n-scrollbar:not(.has-vtrack) > .n-scrollbar-v,
|
77
|
-
.n-scrollbar--native > .n-scrollbar-h,
|
85
|
+
.n-scrollbar--native:not(.n-scrollbar--forced) > .n-scrollbar-h,
|
78
86
|
.n-scrollbar:not(.has-htrack) > .n-scrollbar-h {
|
79
87
|
display: none;
|
80
88
|
}
|
@@ -124,19 +124,41 @@ export default {
|
|
124
124
|
|
125
125
|
data()
|
126
126
|
{
|
127
|
+
let modelValue = Now.make(this.modelValue);
|
128
|
+
|
129
|
+
if ( Any.isEmpty(this.modelValue) ) {
|
130
|
+
modelValue = modelValue.resetTime();
|
131
|
+
}
|
132
|
+
|
127
133
|
return {
|
128
|
-
tempValue:
|
134
|
+
tempValue: modelValue,
|
129
135
|
}
|
130
136
|
},
|
131
137
|
|
138
|
+
mounted()
|
139
|
+
{
|
140
|
+
this.scrollTo();
|
141
|
+
},
|
142
|
+
|
132
143
|
methods: {
|
133
144
|
|
134
145
|
eventSelect(now)
|
135
146
|
{
|
136
|
-
this.$emit('update:modelValue',
|
147
|
+
this.$emit('update:modelValue',
|
137
148
|
(this.tempValue = now.clone()).format(this.format));
|
138
149
|
},
|
139
150
|
|
151
|
+
scrollTo()
|
152
|
+
{
|
153
|
+
let scrollbars = Obj.only(this.$refs, [
|
154
|
+
'hour', 'minute', 'second'
|
155
|
+
]);
|
156
|
+
|
157
|
+
Arr.each(scrollbars, (ref, key) => {
|
158
|
+
ref.scrollIntoView(`[data-index="${this.tempValue[key]()}"]`);
|
159
|
+
});
|
160
|
+
}
|
161
|
+
|
140
162
|
},
|
141
163
|
|
142
164
|
renderToolbar()
|
@@ -145,7 +167,7 @@ export default {
|
|
145
167
|
<div class="n-timepicker-panel__toolbar">
|
146
168
|
<div class="n-timepicker-panel__display">
|
147
169
|
<span class="n-timepicker-panel__time">
|
148
|
-
{
|
170
|
+
{this.tempValue.format(this.displayFormat) || this.placeholder}
|
149
171
|
</span>
|
150
172
|
</div>
|
151
173
|
</div>
|
@@ -167,21 +189,21 @@ export default {
|
|
167
189
|
};
|
168
190
|
|
169
191
|
return (
|
170
|
-
<div class={classList} {...props}>
|
171
|
-
<span>{
|
192
|
+
<div class={classList} {...props} data-index={now.hour()}>
|
193
|
+
<span>{now.format('HH')}</span>
|
172
194
|
</div>
|
173
195
|
);
|
174
196
|
},
|
175
197
|
|
176
198
|
renderHourPanel()
|
177
199
|
{
|
178
|
-
if ( !
|
200
|
+
if ( !this.displayFormat.match('HH') ) {
|
179
201
|
return null;
|
180
202
|
}
|
181
203
|
|
182
204
|
return (
|
183
|
-
<NScrollbar class="n-timepicker-panel__panel" wrapClass="n-timepicker-panel__wrap">
|
184
|
-
{
|
205
|
+
<NScrollbar ref="hour" class="n-timepicker-panel__panel" wrapClass="n-timepicker-panel__wrap">
|
206
|
+
{Arr.each(this.hoursGrid, this.ctor('renderHourItem'))}
|
185
207
|
</NScrollbar>
|
186
208
|
);
|
187
209
|
},
|
@@ -201,21 +223,21 @@ export default {
|
|
201
223
|
};
|
202
224
|
|
203
225
|
return (
|
204
|
-
<div class={classList} {...props}>
|
205
|
-
<span>{
|
226
|
+
<div class={classList} {...props} data-index={now.minute()}>
|
227
|
+
<span>{now.format('mm')}</span>
|
206
228
|
</div>
|
207
229
|
);
|
208
230
|
},
|
209
231
|
|
210
232
|
renderMinutePanel()
|
211
233
|
{
|
212
|
-
if ( !
|
234
|
+
if ( !this.displayFormat.match('mm') ) {
|
213
235
|
return null;
|
214
236
|
}
|
215
237
|
|
216
238
|
return (
|
217
|
-
<NScrollbar class="n-timepicker-panel__panel" wrapClass="n-timepicker-panel__wrap">
|
218
|
-
{
|
239
|
+
<NScrollbar ref="minute" class="n-timepicker-panel__panel" wrapClass="n-timepicker-panel__wrap">
|
240
|
+
{Arr.each(this.minutesGrid, this.ctor('renderMinuteItem'))}
|
219
241
|
</NScrollbar>
|
220
242
|
);
|
221
243
|
},
|
@@ -235,23 +257,21 @@ export default {
|
|
235
257
|
};
|
236
258
|
|
237
259
|
return (
|
238
|
-
<div class={classList} {...props}>
|
239
|
-
<span>{
|
260
|
+
<div class={classList} {...props} data-index={now.second()}>
|
261
|
+
<span>{now.format('ss')}</span>
|
240
262
|
</div>
|
241
263
|
);
|
242
264
|
},
|
243
265
|
|
244
266
|
renderSecondPanel()
|
245
267
|
{
|
246
|
-
if ( !
|
268
|
+
if ( !this.displayFormat.match('ss') ) {
|
247
269
|
return null;
|
248
270
|
}
|
249
271
|
|
250
272
|
return (
|
251
|
-
<NScrollbar class="n-timepicker-panel__panel">
|
252
|
-
|
253
|
-
{ Arr.each(this.secondsGrid, this.ctor('renderSecondItem')) }
|
254
|
-
</div>
|
273
|
+
<NScrollbar ref="second" class="n-timepicker-panel__panel" wrapClass="n-timepicker-panel__wrap">
|
274
|
+
{Arr.each(this.secondsGrid, this.ctor('renderSecondItem'))}
|
255
275
|
</NScrollbar>
|
256
276
|
);
|
257
277
|
},
|
@@ -264,7 +284,7 @@ export default {
|
|
264
284
|
'n-timepicker-panel--' + this.type,
|
265
285
|
];
|
266
286
|
|
267
|
-
if ( this.disabled ){
|
287
|
+
if ( this.disabled ) {
|
268
288
|
classList.push('n-disabled');
|
269
289
|
}
|
270
290
|
|
@@ -274,9 +294,9 @@ export default {
|
|
274
294
|
{this.ctor('renderToolbar')()}
|
275
295
|
</div>
|
276
296
|
<div class="n-timepicker-panel__body">
|
277
|
-
{
|
278
|
-
{
|
279
|
-
{
|
297
|
+
{this.ctor('renderHourPanel')()}
|
298
|
+
{this.ctor('renderMinutePanel')()}
|
299
|
+
{this.ctor('renderSecondPanel')()}
|
280
300
|
</div>
|
281
301
|
</div>
|
282
302
|
);
|
@@ -213,7 +213,7 @@ export default {
|
|
213
213
|
return this.scrollTo(0, targetTop);
|
214
214
|
}
|
215
215
|
|
216
|
-
targetTop = targetTop - this.height +
|
216
|
+
targetTop = targetTop - this.height +
|
217
217
|
this.itemHeight;
|
218
218
|
|
219
219
|
this.scrollTo(0, targetTop);
|
@@ -324,7 +324,7 @@ export default {
|
|
324
324
|
let startItem = Math.round(this.scrollTop /
|
325
325
|
this.itemHeight);
|
326
326
|
|
327
|
-
let endItem = Math.round((this.scrollTop +
|
327
|
+
let endItem = Math.round((this.scrollTop +
|
328
328
|
this.height) / this.itemHeight);
|
329
329
|
|
330
330
|
let start = (startItem - bufferItems);
|
@@ -355,7 +355,7 @@ export default {
|
|
355
355
|
passed.index = (passed.index +
|
356
356
|
this.state.start);
|
357
357
|
|
358
|
-
let topOffset = Math.round(this.itemHeight *
|
358
|
+
let topOffset = Math.round(this.itemHeight *
|
359
359
|
passed.index);
|
360
360
|
|
361
361
|
let renderFunction = this.$slots.default;
|
@@ -388,7 +388,7 @@ export default {
|
|
388
388
|
if ( this.state.grid !== 1 ) {
|
389
389
|
style.width = this.itemWidth + 'px';
|
390
390
|
}
|
391
|
-
|
391
|
+
|
392
392
|
return (
|
393
393
|
<div class="n-virtualscroller__item" style={style} {...props}>
|
394
394
|
{ renderFunction(passed) }
|
@@ -424,7 +424,7 @@ export default {
|
|
424
424
|
let counter = passed.index * this.state.start;
|
425
425
|
|
426
426
|
return (
|
427
|
-
<div class="n-virtualscroller__row" style={style}>
|
427
|
+
<div data-row={passed.index} class="n-virtualscroller__row" style={style}>
|
428
428
|
{
|
429
429
|
Arr.each(passed.chunk, (value, index) => {
|
430
430
|
return this.ctor('renderItem')({
|
@@ -444,7 +444,7 @@ export default {
|
|
444
444
|
let items = Arr.slice(chunks, this.state.start,
|
445
445
|
this.state.end);
|
446
446
|
|
447
|
-
if ( ! this.threshold || this.threshold >
|
447
|
+
if ( ! this.threshold || this.threshold > this.items.length ) {
|
448
448
|
items = chunks;
|
449
449
|
}
|
450
450
|
|
@@ -484,13 +484,15 @@ export default {
|
|
484
484
|
onSizechange: this.onSizechange,
|
485
485
|
};
|
486
486
|
|
487
|
-
let style = {
|
487
|
+
let style = {
|
488
|
+
'overflow-y': 'hidden'
|
489
|
+
};
|
488
490
|
|
489
|
-
let totalHeight = this.items.length / this.state.grid *
|
491
|
+
let totalHeight = Math.ceil(this.items.length / this.state.grid) *
|
490
492
|
this.itemHeight;
|
491
493
|
|
492
494
|
if ( this.threshold && this.items.length ) {
|
493
|
-
style.height = Math.ceil(totalHeight) + 'px';
|
495
|
+
style.height = Math.ceil(totalHeight + this.offsetY) + 'px';
|
494
496
|
}
|
495
497
|
|
496
498
|
return (
|