@kizmann/nano-ui 0.8.28 → 0.8.30
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 +3 -3
- 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/paginator/src/paginator/paginator.js +4 -0
- package/src/preview/src/preview-image/preview-image.js +13 -4
- 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
@@ -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()
|
@@ -87,9 +96,9 @@ export default {
|
|
87
96
|
'n-preview-image'
|
88
97
|
];
|
89
98
|
|
90
|
-
|
91
|
-
|
92
|
-
|
99
|
+
if ( Arr.has(window.ImageCache, this.src) ) {
|
100
|
+
classList.push('n-cached');
|
101
|
+
}
|
93
102
|
|
94
103
|
if ( ! this.load ) {
|
95
104
|
classList.push('n-ready');
|
@@ -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 (
|